Skip to content

Commit

Permalink
Added some examples
Browse files Browse the repository at this point in the history
  • Loading branch information
pablouser1 committed Aug 13, 2022
1 parent 9ed79c8 commit dd94ff0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ You can send a POST request to http://localhost:8080/signature with a raw/plain

If you plan to use the already deployed Vercel version, you should use https://signtok.vercel.app/api/signature

You can see some examples [here](https://github.com/pablouser1/SignTok/blob/master/examples)

### Cli
```
node local.js 'YOUR_URL_HERE'
Expand Down
19 changes: 19 additions & 0 deletions examples/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Example using native fetch
*/

// You can replace this with your signing instance
const SIGNING_URL = 'http://localhost:8080/signature'

const EXAMPLE_URL = 'https://m.tiktok.com/api/post/item_list?count=30&id=6941611380308870149&cursor=0&type=1&secUid=MS4wLjABAAAA7DfOn_jwWM7Rscrl2SGPW06eYI0bUDXRoRoTcSpw_Bsndydsbk8zH3tZe2Tz9FoJ&sourceType=8&appId=1233&aid=1988&app_language=en&app_name=tiktok_web&browser_language=en-us&browser_name=Mozilla&browser_online=1&browser_platform=iPhone&browser_version=Mozilla%252F5.0%2B%2528Macintosh%253B%2BIntel%2BMac%2BOS%2BX%2B10_15_6%2529%2BAppleWebKit%252F537.36%2B%2528KHTML%252C%2Blike%2BGecko%2529%2BChrome%252F98.0.4758.109%2BSafari%252F537.36&channel=tiktok_web&cookie_enabled=1&device_platform=web_mobile&focus_state=1&history_len=3&is_fullscreen=0&is_page_visible=1&os=ios&priority_region=&referer=&region=us&screen_width=1920&screen_height=1080&timezone_name=America%2FChicago&webcast_language=en&device_id=9632257621121311443'

fetch(SIGNING_URL, {
method: 'POST',
body: EXAMPLE_URL
}).then(
plain => plain.json()
).then(res => {
console.log(res.data.signed_url)
}).catch(err => {
console.error(err)
})
16 changes: 16 additions & 0 deletions examples/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import requests

"""
Example using Python requests
"""

# You can replace this with your signing instance
SIGNING_URL = 'http://localhost:8080/signature'

EXAMPLE_URL = 'https://m.tiktok.com/api/post/item_list?count=30&id=6941611380308870149&cursor=0&type=1&secUid=MS4wLjABAAAA7DfOn_jwWM7Rscrl2SGPW06eYI0bUDXRoRoTcSpw_Bsndydsbk8zH3tZe2Tz9FoJ&sourceType=8&appId=1233&aid=1988&app_language=en&app_name=tiktok_web&browser_language=en-us&browser_name=Mozilla&browser_online=1&browser_platform=iPhone&browser_version=Mozilla%252F5.0%2B%2528Macintosh%253B%2BIntel%2BMac%2BOS%2BX%2B10_15_6%2529%2BAppleWebKit%252F537.36%2B%2528KHTML%252C%2Blike%2BGecko%2529%2BChrome%252F98.0.4758.109%2BSafari%252F537.36&channel=tiktok_web&cookie_enabled=1&device_platform=web_mobile&focus_state=1&history_len=3&is_fullscreen=0&is_page_visible=1&os=ios&priority_region=&referer=&region=us&screen_width=1920&screen_height=1080&timezone_name=America%2FChicago&webcast_language=en&device_id=9632257621121311443'

r = requests.post(SIGNING_URL, data=EXAMPLE_URL)

if r.ok:
r_json = r.json()
print(r_json['data']['signed_url'])

1 comment on commit dd94ff0

@vercel
Copy link

@vercel vercel bot commented on dd94ff0 Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.