1234567891011121314151617181920212223242526272829 |
- import json
- from applications.utils import AsyncHttpClient
- async def search_in_toutiao(keyword):
- url = "http://crawler-cn.aiddit.com/crawler/tou_tiao_hao/keyword"
- data = {
- "keyword": keyword,
- }
- headers = {
- "Content-Type": "application/json",
- }
- async with AsyncHttpClient(timeout=120) as client:
- response = await client.post(url, json=data, headers=headers)
- return response
- async def get_toutiao_detail(link):
- url = "http://crawler-cn.aiddit.com/crawler/tou_tiao_hao/detail"
- data = {
- "content_link": link,
- }
- headers = {
- "Content-Type": "application/json",
- }
- async with AsyncHttpClient(timeout=120) as client:
- response = await client.post(url, json=data, headers=headers)
- return response
|