Mythus commited on
Commit
4638ba5
·
verified ·
1 Parent(s): b5a7f1a

Update streamingwatch.py

Browse files
Files changed (1) hide show
  1. streamingwatch.py +5 -2
streamingwatch.py CHANGED
@@ -39,7 +39,6 @@ def search(showname,season,episode,date,ismovie):
39
  'wordpress_test_cookie': 'WP%20Cookie%20check',
40
  }
41
  response = requests.post(query,cookies=cookies, headers=headers, data=data)
42
- print(response.content)
43
  soup = BeautifulSoup(response.content,'lxml')
44
  page_date = soup.find(id = 'search-cat-year').text.strip()
45
  if page_date == date:
@@ -51,7 +50,11 @@ def search(showname,season,episode,date,ismovie):
51
 
52
  return hdplayer
53
  elif ismovie == 0:
54
- query = f'https://streamingwatch.{SW_DOMAIN}/wp-json/wp/v2/posts?search={showname}&per_page=100'
 
 
 
 
55
  response = requests.get(query)
56
  data_json = response.text
57
  data = json.loads(data_json)
 
39
  'wordpress_test_cookie': 'WP%20Cookie%20check',
40
  }
41
  response = requests.post(query,cookies=cookies, headers=headers, data=data)
 
42
  soup = BeautifulSoup(response.content,'lxml')
43
  page_date = soup.find(id = 'search-cat-year').text.strip()
44
  if page_date == date:
 
50
 
51
  return hdplayer
52
  elif ismovie == 0:
53
+ #Some series have the name in english so we first search with the categories option and then we use the obtained ID to get all the episodes
54
+ id_response = requests.get(f'https://streamingwatch.{SW_DOMAIN}/wp-json/wp/v2/categories?search={showname}&_fields=id')
55
+ data = json.loads(id_response.text)
56
+ category_id = data[0]['id']
57
+ query = f'https://streamingwatch.{SW_DOMAIN}/wp-json/wp/v2/posts?categories={category_id}&per_page=100'
58
  response = requests.get(query)
59
  data_json = response.text
60
  data = json.loads(data_json)