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
plugins.tf1: Permission insuffisante #5379
Comments
confirmed for me. |
I dont think so because apparently tf1 max's purpose is to propose an ad-free streaming experience as well as HD streaming. |
It's not because of this. It now requires a JWT token in order to get access to their metadata. This token can be found by doing a single request to their API on post login, to this website : https://www.tf1.fr/token/gigya/web. It'll need a token based on the Gigya signature (UIDSignature on Gigya login -> https://compte.tf1.fr/accounts.login). |
Do you think you would know how to update the current plugin ? |
It would need a POST to https://compte.tf1.fr/accounts.login
You then grab the UIDSignature and the UID from the Gigya response (either from the accounts login, either from the userInfo, UID + UIDSignature). You then POST to https://www.tf1.fr/token/gigya/web, in order for this request to work you will also need to create a timestamp in EPOCH/UNIX format (something like 1687780538)
You grab the "token" from the JSON answer. After that, you can do a GET request to https://mediainfo.tf1.fr/mediainfocombo/L_TF1?pver=5010000&context=MYTF1&topDomain=unknown&platform=web&device=desktop&os=windows&osVersion=10.0&playerVersion=5.10.0&productName=mytf1&productVersion=2.59.2&browser=firefox&browserVersion=114 with a specific header Authorization : Bearer token. Answer will be in "delivery" -> "url" |
if you fork the current plugin, let me know, thanks :) |
Hi @BellezaEmporium I try your advice, got the token and got the url into delivery. This is the log :
Do you know what I'm doing wrong ? |
I'll have to check as I'm quite unsure about if it's a Streamlink DASH issue or TF1 having the live feed + 4 hours of replay. |
Putting the link into yt-dlp gives me several video tracks, I think streamlink doesn't record the newest one :
|
Don't post media files here. I've hid the post now. If it's an issue with the DASHStream implementation, then you'll have to provide the full DASH manifest and the full trace log, so the segment timestamps can be checked. This is off topic though and should be posted in a new thread. There is a thread about DASH timing offsets: #5201 |
Sorry, I delete them. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Fix the plugin and send a pull request. |
obviously if I could I would |
This comment was marked as spam.
This comment was marked as spam.
This will most certainly need a bit of a relift but here's my take on it : https://raw.githubusercontent.com/BellezaEmporium/streamlink/master/src/streamlink/plugins/tf1.py There's a system of "token + refresh token" implemented in TF1's website, though I have not added the refresh logic to the code data yet, as i'm thinking on how to store account information in order from Streamlink to grab available data without having the need to reconnect.
|
thanks a lot for fixing this. has been quite some time now ! |
It was therefore clearly linked to the obligation to identify oneself due to the existence of MyTF1 Max, as I had assumed. Translated from: |
I think to watch on their site, even before, you had to be logged in . can't really remember, I rarely use that site anyway |
No.
me yes. |
Linked to the introduction of PPV streams in MyTF1 (since Star Academy's 24/7 streams, even before I believe). |
Hello there, @BellezaEmporium I tried your file, but i got this error : streamlink https://www.tf1.fr/tf1/direct
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Program Files\Streamlink\bin\streamlink.exe\__main__.py", line 18, in <module>
File "C:\Program Files\Streamlink\pkgs\streamlink_cli\main.py", line 963, in main
error_code = run(parser)
^^^^^^^^^^^
File "C:\Program Files\Streamlink\pkgs\streamlink_cli\main.py", line 936, in run
handle_url()
File "C:\Program Files\Streamlink\pkgs\streamlink_cli\main.py", line 543, in handle_url
options = setup_plugin_options(pluginname, pluginclass)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Streamlink\pkgs\streamlink_cli\main.py", line 749, in setup_plugin_options
value = getattr(args, parg.namespace_dest(pluginname))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'tf1_username' I've tried to found out alone but i'm not a dev so i don't get shit about what's wrong :( If i'm trying with a login throught this cmd
i've this message usage: streamlink [OPTIONS] <URL> [STREAM]
streamlink: error: unrecognized arguments: --tf1-username=**** I saw that you add this line from streamlink.plugin.plugin import pluginargument which is not the same when i compare to another plugin so i deleted it and added it to this line from streamlink.plugin import Plugin, pluginargument, PluginError, pluginmatcher but it doesn't changed anything :( Also i don't see the tf1 help section you added using the cmd --help I would appreciate your help if you can 👍 see ya |
it was never merged into the main project, curiously.. |
With the recent spam/abuse in mind which I've received by other users, I'm going to say this now: @campones The attitude you've been showing here for the past couple of years is highly annoying. To remind you, this is a free open source software project run by volunteers in their free time. All you however do is request urgent help, attention and time without ever contributing back to the project in any way (while also abusing the software for monetary gains from what I believe by rehosting streams on your own servers - which is extra annoying to me).
If nobody submits a pull request with a fix for the plugin, then it remains broken on the master branch unless the maintainers take a look at it themselves. "The maintainers" (plural) however has been pretty much me (singular) for a very long time now because everyone else who had an actual interest in the project and/or had regularly contributed code has left (be it health issues or other various reasons). Considering that there are additional obstacles in the way in the shape of required user accounts, I don't have much motivation fixing the plugin. If anyone however had submitted a pull request, I would have certainly given it a proper review which would have very likely led to a merge if the author could have shown me log outputs of a working plugin. This has still not happened today. I can't be bothered looking for branches on any forks where certain plugins might have been fixed. Sideloading plugins or forking the project for personal modifications is perfectly fine (within the limits of the project's license), but if no one even thinks about contributing back via pull requests, then please don't wonder why plugins remain broken or get removed eventually. Same with any other issues regarding Streamlink's code base. Questioning maintainer activity or constantly asking why XYZ hasn't been fixed yet, and thus once again being annoying by trying to apply pressure without contributing back yourself is just a super shitty thing to do, even as a regular user who doesn't know how to write code. Things like this make me feel less and less motivated working on the project... As said at the beginning, I've just been spammed by other users recently with the exact same demanding attitude. |
I won't even bother to answer. |
To answer on my behalf, I simply don't do pull requests because that would most certainly add all the other plugins I've did to the list. Which would be irrelevant in the base of this issue. I've did a few personal plugins based on Streamlink's plugin schema, in order for me to fully understand how the technology works. If they see the light of day in the form of a PR, they might need a certain amount of rework to fit the new plugin structure. |
@BellezaEmporium I'm totally sorry to bothering you but i'm an advanced computer user but not a dev, so i just need help for few editing to makes this past post functionning. Is that community starts to be toxic as everyone else on the internet by this days ? |
i mean every IT executor knows that there is that much sector that you can't be performant on every sector right ?! |
This comment was marked as off-topic.
This comment was marked as off-topic.
@W4RdZ I m using this with streamlink 6.5.0 |
Might be a change in the newer versions of Streamlink. Please take note that I've made the plugin in the version that was available in December 2023. If you did an update afterwards, I might not know what has changed or not. Might be an option call change in the newer versions of Streamlink, as it seems to not recognize any of the options that are mandatory for this plugin. |
yes, I have been updating one local server with latest streamlink release and indeed it doesn't work anymore streamlink: error: unrecognized arguments: --tf1-username *** --tf1-password *** https://www.tf1.fr/tf1/direct |
ty for your obvious statment 🥇 i'm asking help about the plugin you developped to make it working on the last version. Ty for your consideration ! |
well just downgrade the streamlink release and that should be fine? pip uninstall streamlink |
must be related to this |
You are not sideloading the plugin but instead overwriting the regular plugin module, which is unsupported. You are not supposed to touch any files in a Python distribution. Read the documentation on how to sideload new or override existing plugins: The error you're seeing is a consequence of overwriting the regular plugin file and trying to add new plugin arguments. This is explicitly unsupported with the addition of lazy plugin loading in 6.6.0: |
Ah well thanks for pointing me to the right direction. I'll take a check soon then. |
Thanks, loading the plugin from the right path works, but i think the code must be reworked a bit to fit with the update. Maybe you can help me to understand which part of BellezaEmporium code tries to add arguments (Sorry, i really have only basics on general dev.) In a first approch i thought it was about these parts of the code : @pluginargument(
"username",
requires=["password"],
metavar="USERNAME",
help="The username used to register with tf1.fr.",
)
@pluginargument(
"password",
prompt="Enter tf1.fr account password",
sensitive=True,
metavar="PASSWORD",
help="A tf1.fr account password to use with --tf1-username.",
) and def _get_streams(self):
if not self.get_option("username"):
log.error(
"In order to access your content, TF1 requires an account you must login with, using "
+ "--tf1-username and --tf1-password",
)
return
if not self.login(self.get_option("username"), self.get_option("password")):
log.error(
"Could not authenticate, check your username and password.")
return
channel, channel_id = self._get_channel()
log.debug(f"Found channel {channel} ({channel_id})")
code, data = self._api_call(channel_id)
if code != 200:
log.error(data)
return
return HLSStream.parse_variant_playlist(self.session, data) So i've edited it for this : @pluginargument(
"username",
required=True,
requires=["password"],
metavar="USERNAME",
help="Your TF1 account username",
)
@pluginargument(
"password",
required=True,
sensitive=True,
metavar="PASSWORD",
help="Your TF1 account password",
) and def _get_streams(self):
if not self.login(self.get_option("username"), self.get_option("password")):
log.error("Failed to login, check username and password")
return
channel, channel_id = self._get_channel()
log.debug(f"Found channel {channel} ({channel_id})")
code, data = self._api_call(channel_id)
if code != 200:
log.error(data)
return
return HLSStream.parse_variant_playlist(self.session, data) But the error message remains almost the same as original BellezaEmporium code, only the line numbers change because of my editing : Enter tf1 password:
[cli][info] Found matching plugin tf1 for URL https://www.tf1.fr/tf1/direct
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Program Files\Streamlink\bin\streamlink.exe\__main__.py", line 18, in <module>
File "C:\Program Files\Streamlink\pkgs\streamlink_cli\main.py", line 963, in main
error_code = run(parser)
^^^^^^^^^^^
File "C:\Program Files\Streamlink\pkgs\streamlink_cli\main.py", line 936, in run
handle_url()
File "C:\Program Files\Streamlink\pkgs\streamlink_cli\main.py", line 556, in handle_url
streams = fetch_streams(plugin)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Streamlink\pkgs\streamlink_cli\main.py", line 454, in fetch_streams
return plugin.streams(stream_types=args.stream_types,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Streamlink\pkgs\streamlink\plugin\plugin.py", line 387, in streams
ostreams = self._get_streams()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\***\AppData\Roaming\streamlink\plugins\tf1.py", line 156, in _get_streams
if not self.login(self.get_option("username"), self.get_option("password")):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\***\AppData\Roaming\streamlink\plugins\tf1.py", line 149, in login
if auth_check() == True:
^^^^^^^^^^^^
File "C:\Users\***\AppData\Roaming\streamlink\plugins\tf1.py", line 134, in auth_check
"uid": res.json()['userInfo']['UID'],
~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'userInfo' As few as i comprehend, it must point on this part of the code : def auth_check():
res = self.session.http.post(
self.auth_url,
data=dict(
loginID=username,
password=password,
APIKey=self.gigya_api_key,
includeUserInfo="true"
),
headers={"Referer": self.url, "User-Agent": useragents.IPHONE})
# If TF1 login is successful, get Gigya token.
if res.status_code == 200:
# make the session request to get the correct cookies
session_res = self.session.http.post(
self.session_url,
data=json.dumps({
"uid": res.json()['userInfo']['UID'],
"signature": res.json()['userInfo']['UIDSignature'],
"timestamp": int(res.json()['userInfo']['signatureTimestamp']),
"consent_ids": ["1", "2", "3", "4", "10001", "10003", "10005", "10007", "10013", "10015", "10017", "10019", "10009", "10011", "13002", "13001", "10004", "10014", "10016", "10018", "10020", "10010", "10012", "10006", "10008"]
})
)
if session_res.status_code == 200:
self.user_token = session_res.json()['token']
return True
else:
return False
else:
return False
if auth_check() == True:
log.debug("Already authenticated, skipping authentication")
return True
else:
return False I've the feeling it's more about change like these whiches make the code not working #5807 #5814 But for me it's getting too complicated 😒 |
The reason for the error you've posted is simple: the third party plugin does not do any error handling and HTTP response validation, hence the So I'm saying this one again. If you want this plugin fixed, then open a pull request. I'm not going to review any code on any user branches or code downloaded from somewhere else. I can already tell you though that all the changes made in the linked plugin code are implemented pretty poorly and require a whole rewrite. |
i'll make that 😎 |
Checklist
Streamlink version
Latest stable release
Description
Hi
Not sure exactly what means "permissions insuffisante" but sounds like something changed. Only LCI is still working
Debug log
The text was updated successfully, but these errors were encountered: