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

[WO - FRANCE24] Fix live Error 403 #1458

Merged
merged 1 commit into from
Jan 28, 2025
Merged
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
17 changes: 10 additions & 7 deletions resources/lib/channels/wo/france24.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@
TOKEN_APP = '66b85dad-3ad5-40f3-ab32-2305fc2357ea'
URL_API = utils.urljoin_partial('https://apis.france24.com')

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


@Route.register
def root_catchup_tv(plugin, item_id, **kwargs):
# http://apis.france24.com/products/get_product/78dcf358-9333-4fb2-a035-7b91e9705b13?token_application=66b85dad-3ad5-40f3-ab32-2305fc2357ea
root_json_url = 'products/get_product/78dcf358-9333-4fb2-a035-7b91e9705b13'
root_json_r = urlquick.get(URL_API(root_json_url),
headers={'User-Agent': web_utils.get_random_ua()},
headers=GENERIC_HEADERS,
params={'token_application': TOKEN_APP})
json_root = json.loads(root_json_r.text)

Expand Down Expand Up @@ -100,7 +103,7 @@ def list_direct_tv_jts(plugin, item_id, guid, **kwargs):
json_url = 'products/get_product/%s' % guid
json_r = urlquick.get(URL_API(json_url),
params={'token_application': TOKEN_APP},
headers={'User-agent': web_utils.get_ua()})
headers=GENERIC_HEADERS)
json_v = json.loads(json_r.text)
try:
json_channels = json_v['result']['channels']
Expand Down Expand Up @@ -138,7 +141,7 @@ def list_videos(plugin, item_id, guid, page=1, **kwargs):
params={
'token_application': TOKEN_APP,
'page': page},
headers={'User-agent': web_utils.get_ua()})
headers=GENERIC_HEADERS)
json_v = json.loads(json_r.text)
try:
json_list = json_v['result']['list']
Expand Down Expand Up @@ -173,7 +176,7 @@ def list_last_edition(plugin, item_id, guid, **kwargs):
json_url = 'products/get_product/%s' % guid
json_r = urlquick.get(URL_API(json_url),
params={'token_application': TOKEN_APP},
headers={'User-agent': web_utils.get_ua()})
headers=GENERIC_HEADERS)
json_v = json.loads(json_r.text)
try:
json_list = json_v['result']['list']
Expand Down Expand Up @@ -210,7 +213,7 @@ def list_all_programs(plugin, item_id, guid, guid_program, page=1, **kwargs):
json_url = 'products/get_product/%s' % guid
json_r = urlquick.get(URL_API(json_url),
params={'token_application': TOKEN_APP},
headers={'User-agent': web_utils.get_ua()})
headers=GENERIC_HEADERS)
json_v = json.loads(json_r.text)
try:
json_list = json_v['result']['list']
Expand Down Expand Up @@ -256,7 +259,7 @@ def list_program_video(plugin, item_id, nid, guid_program, page=1, **kwargs):
'token_application': TOKEN_APP,
'nid': nid,
'page': page},
headers={'User-agent': web_utils.get_ua()})
headers=GENERIC_HEADERS)
json_v = json.loads(json_r.text)

try:
Expand Down
Loading