Skip to content

[fix] newpct - Detect correct IDs#1838

Merged
liiight merged 3 commits intoFlexget:developfrom
rsalas:develop
May 27, 2017
Merged

[fix] newpct - Detect correct IDs#1838
liiight merged 3 commits intoFlexget:developfrom
rsalas:develop

Conversation

@rsalas
Copy link
Copy Markdown
Contributor

@rsalas rsalas commented May 23, 2017

Take all the IDs of the content on the page but the valid are those are within "parametros".

Detailed changes:

  • Update the regular expression that detects the IDs.

RegEx Test

Replace: (?:parametros\s*=\s*.*?) for check match.

rsalas added 2 commits May 23, 2017 13:32
Take all the IDs of the content on the page but only those that are within "parametros".
Remove all line breaks
@Aokromes
Copy link
Copy Markdown

This fixes the "- maybe a login page?)" thing i have noticed on the last day?

@liiight
Copy link
Copy Markdown
Member

liiight commented May 24, 2017

If someone wanna confirm this fix ill merge it

@rsalas
Copy link
Copy Markdown
Contributor Author

rsalas commented May 24, 2017

@Aokromes No, it's for download pages.
It does not correctly detect the torrent ID and does not give a permanent redirect error.

@malkavi
Copy link
Copy Markdown
Contributor

malkavi commented May 24, 2017

We need to convert all "\n" and "\r" from a webpage? In my opinion is excessive.

I have fixed the error just by changing this line:
torrent_id_prog = re.compile(",\s*'(?:torrentID|id)'\s*:\s*'(\d+)'")
to avoid the 'id' from the ad.

But that solution also will work.
About the login page error, it's related to a false torrent caused by taking the 'id' from an ad. This PR or my fix will fix the error.

@rsalas
Copy link
Copy Markdown
Contributor Author

rsalas commented May 24, 2017

@malkavi I have tried your solution but can not find any ID.
If you check your solution with the link above, you will see that do not work.

In my example link the html is in one line, beause the "\n" is literal not is a new line
Need replace all line break, for parse multiple lines in one regular expression.
It is possible that I am confused, correct me if I am wrong.

@malkavi
Copy link
Copy Markdown
Contributor

malkavi commented May 24, 2017

@rsalas Please try with non edited/replaced webpage. Copy and Paste a new one using control+u.
Example: https://regex101.com/r/vaGfdf/2

Maybe better this way?
https://regex101.com/r/vaGfdf/4
or too complicated?
That way we can be sure that the id is from the struct 'parametros'. (based on your regexp @rsalas )

@rsalas
Copy link
Copy Markdown
Contributor Author

rsalas commented May 24, 2017

@malkavi The second regular expression I like, because if the ad has a "," previous will take this id, with "parametros" is more safely.

I change the PR.

@malkavi
Copy link
Copy Markdown
Contributor

malkavi commented May 25, 2017

It's OK for me. I have tested this PR successfully. Added a new serie and downloaded the torrent.

Test: "Los Pasajeros Del Tiempo"

`FlexGet has just downloaded 1 new entries for task mis_series:

  • Los Pasajeros Del Tiempo - Temporada 1 [HDTV][Cap.101][Español Castellano] (url removed, torrentid:091872)`

@tubedogg tubedogg changed the title Detects the wrong ID in NewPCT plugin [fix] newpct - Detect correct IDs May 26, 2017
@Aokromes Aokromes mentioned this pull request May 27, 2017
@liiight liiight merged commit 5fa7b51 into Flexget:develop May 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants