-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix #208: broken tv_grab_pt_meo #217
Fix #208: broken tv_grab_pt_meo #217
Conversation
Endpoints have moved to a separate services' host.
While the previous version of the API apparently accepted malformed JSON, the current version rejects invalid payloads.
Some hosts expect specific HTTP header values to validate a request; accept them as an optional argument, to make it backward compatible.
The endpoints now reject requests which do not present the expected Origin.
Nice detective work! However... Spoofing the |
@moob158 I had written a long response but it is probably invalid now (see @honir's comment above, and mine further below); will leave some notes though. @honir I feared that, and I totally understand :P I had understood XMLTV strives to be a "good netizen", but was hoping not spoofing the |
So adding an Origin header and keeping an XMLTV user-agent works? That's interesting... I can see the argument "Origin" is really just part of the API and if we're setting user-agent, we're not hiding who we are (and easily block-able if desired). Geoff, did you realize that user-agent wasn't changing? |
By spoofing the
You are effectively saying, "trust me, I'm from the Meo app"...but you're not. You're really xmltv.org! (This is why browsers do not allow manual setting of the As the site is actively checking the |
@rmeden Let me clarify that I agree with @honir; With that said, I'm assuming this PR should be closed (and that |
It will probably be removed in the next release (c. January?). We can leave it till then in case MEO have a change of heart and reinstate the previous urls (...unlikely, but you never know!) |
Closing this PR; again, thank you all for this project! |
What type of Pull Request is this?
Does this PR close any currently open issues?
This PR fixes #208.
Please explain what this PR does
tv_grab_pt_meo
currently had several issues:POST
ed to the API were malformed (the structure remains the same), which were rejected by the "new" API;Origin
header matchinghttps://www.meo.pt
.This PR addresses those issues, and extends XMLTV::Get_nice::post_nice_json() to accept an optional hash of HTTP headers to be included in the HTTP request; I wasn't sure whether this would feel the right approach, but given this function only appears to be used in
tv_grab_pt_meo
I thought it was ok. Any suggestions more than welcome.Any other information?
I am not at all familiar with Perl; read a couple of things to understand some of the basics, what was the meaning of the
$$
signature, ... I believe the changes "make sense", but I feel there might be some Perl-specifics I might be missing. Please advise if so.This change has not been discussed on the xmltv-devel mailing list.
Where have you tested these changes?
Operating System: Alpine Linux
v3.18.4
Perl Version:
v5.36.1