Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR - CNEWS] Fix Error 403 #1447

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions resources/lib/channels/fr/cnews.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
# num Page
URL_VIDEOS_CNEWS = URL_ROOT_SITE + '/service/dm_loadmore/dm_emission_index_sujets/%s/0'

GENERIC_HEADERS = {'User-Agent': web_utils.get_random_windows_ua()}
# GENERIC_HEADERS = {'User-Agent': web_utils.get_random_windows_ua()}
GENERIC_HEADERS = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0',
}


# num Page
Expand Down Expand Up @@ -56,7 +59,7 @@ def list_categories(plugin, item_id, **kwargs):

@Route.register
def list_videos(plugin, item_id, category_url, page, **kwargs):
resp = urlquick.get(category_url % page, headers=GENERIC_HEADERS, max_age=-1)
resp = urlquick.get(category_url % page, headers=GENERIC_HEADERS, verify=False, max_age=-1)
parser = htmlement.HTMLement()
parser.feed(resp.json())
data = parser.close()
Expand All @@ -82,7 +85,7 @@ def get_video_id(plugin, video_id, download_mode=False, **kwargs):

@Route.register
def list_emissions(plugin, item_id, category_url, page, **kwargs):
resp = urlquick.get(URL_REPLAY_CNEWS, headers=GENERIC_HEADERS, max_age=-1)
resp = urlquick.get(URL_REPLAY_CNEWS, headers=GENERIC_HEADERS, verify=False, max_age=-1)
data = resp.parse("div", attrs={"class": "les-emissions"})

for video_datas in data.iterfind(".//a[@class='emission-item-wrapper']"):
Expand Down Expand Up @@ -121,7 +124,7 @@ def list_emissions_old(plugin, item_id, category_url, page, **kwargs):

@Route.register
def list_videos_emission(plugin, item_id, video_url, **kwargs):
resp = urlquick.get(video_url, headers=GENERIC_HEADERS, max_age=-1)
resp = urlquick.get(video_url, headers=GENERIC_HEADERS, verify=False, max_age=-1)
root = resp.parse()

info = root.findall(".//p")[0].text
Expand Down Expand Up @@ -153,15 +156,15 @@ def list_videos_emission(plugin, item_id, video_url, **kwargs):

@Resolver.register
def get_video_url(plugin, item_id, video_url, download_mode=False, **kwargs):
root = urlquick.get(video_url, headers=GENERIC_HEADERS, max_age=-1).parse()
root = urlquick.get(video_url, headers=GENERIC_HEADERS, verify=False, max_age=-1).parse()
video_id = root.find(".//div[@id='embed-main-video']").get('data-videoid')

return resolver_proxy.get_stream_dailymotion(plugin, video_id, download_mode)


@Resolver.register
def get_live_url(plugin, item_id, **kwargs):
root = urlquick.get(URL_LIVE_CNEWS, headers=GENERIC_HEADERS, max_age=-1).parse()
root = urlquick.get(URL_LIVE_CNEWS, headers=GENERIC_HEADERS, verify=False, max_age=-1).parse()
try:
live_id = root.find(".//div[@data-muted='true']").get('data-videoid')
except Exception:
Expand Down
Loading