38 lines
807 B
Python
38 lines
807 B
Python
|
|
import sys
|
|
import os
|
|
import logging
|
|
|
|
# Add project root to path
|
|
sys.path.append(r'd:\dsWork\aiData\DouYin')
|
|
|
|
from apiproxy.douyin.douyin import Douyin
|
|
from apiproxy.common import utils
|
|
|
|
# Configure logging
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
def test():
|
|
dy = Douyin()
|
|
url = "https://v.douyin.com/gHWfWVgDVRo/"
|
|
|
|
print(f"Testing URL: {url}")
|
|
|
|
# Get Key
|
|
key_type, key = dy.getKey(url)
|
|
print(f"Key Type: {key_type}, Key: {key}")
|
|
|
|
if key and key_type == 'aweme':
|
|
# Get Info
|
|
print("Fetching info...")
|
|
info = dy.getAwemeInfo(key)
|
|
if info:
|
|
print(f"Success! Title: {info.get('desc')}")
|
|
else:
|
|
print("Failed to get info.")
|
|
else:
|
|
print("Failed to get key.")
|
|
|
|
if __name__ == "__main__":
|
|
test()
|