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

Tumblr video recognition requires update #130

Open
MegaScience opened this issue Nov 5, 2016 · 1 comment
Open

Tumblr video recognition requires update #130

MegaScience opened this issue Nov 5, 2016 · 1 comment

Comments

@MegaScience
Copy link
Contributor

Tumblr did a slight change to their webpage which my regular expression didn't account for. Luckily, the fallback I put into the code allowed it to still grab the first image of the page, but it stopped recognizing additional images and videos.

The change was simply adding a new line and some spacing in the <script> element it looks for. I've adjusted the regular expression accordingly:

var obj = responseText.match(/(?:<!-- GOOGLE CAROUSEL -->)?<script[^>]+type="application\/ld\+json"[^>]*>(?:[\r\n\t\s ]+)?(.+?)(?:[\r\n\t\s ]+)?<\/script>/i),
@thelastfantasy
Copy link

thelastfantasy commented Jun 14, 2017

var obj = responseText.replace(/\n/g,'').replace(/>\t/g,'>').match(/({"@type.+schema\.org\"})<\/script>/i);

This should be the last one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants