search.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. """
  2. @author: luojunhui
  3. """
  4. import json
  5. from typing import List, Dict
  6. import requests
  7. def search_in_wechat_channel(
  8. search_key: str,
  9. search_type: int,
  10. page: int = 0,
  11. cookie: str = "",
  12. search_id: str = "",
  13. offset: int = 0,
  14. ) -> Dict:
  15. """
  16. :param search_key: 搜索关键字
  17. :param search_type: 搜索类型,1: 搜索所有视频, 2: 搜索视频号账号
  18. :param page: 页码
  19. :param cookie: 登录后的cookie
  20. :param search_id: 搜索id
  21. :param offset: 偏移量
  22. :return: result_list
  23. """
  24. token = "d3fb918f-0f36-4769-b095-410181614231"
  25. app_id = "wx_GKpVW8xfEhcaxMIK9sSm6"
  26. url = "http://api.geweapi.com/gewe/v2/api/finder/search"
  27. payload = json.dumps(
  28. {
  29. "appId": app_id,
  30. "proxyIp": "",
  31. "content": search_key,
  32. "category": search_type,
  33. "filter": 0,
  34. "page": page,
  35. "cookie": cookie,
  36. "searchId": search_id,
  37. "offset": offset,
  38. }
  39. )
  40. headers = {"X-GEWE-TOKEN": token, "Content-Type": "application/json"}
  41. response = requests.request("POST", url, headers=headers, data=payload, timeout=60)
  42. response_json = response.json()
  43. return response_json