Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
nleush committed Jul 23, 2024
2 parents 0173e1f + c29ce0f commit df40642
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/plugins/system/htmlparser/htmlparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default {
headers: {}
});
} else if (!!options.exposeStatusCode
&& error.message === 'too_many_redirects') {
&& (error.message === 'too_many_redirects' || error === 'too_many_redirects')) {

cb(null, {
__statusCode: 508, // Hello Instagram, see #503
Expand Down
9 changes: 8 additions & 1 deletion lib/plugins/system/oembed/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -1094,5 +1094,12 @@
],
"endpoint": "https://display.apester.com/oembed/",
"url": "https://renderer.apester.com/v2/{1}"
}
},
{
"name": "Bitchute",
"templates": [
"bitchute.com/video/*"
],
"endpoint": "https://api.bitchute.com/oembed/"
}
]
18 changes: 18 additions & 0 deletions plugins/custom/meta-fallback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default {

provides: 'meta',

getData: function(url, __statusCode, options, cb) {

return __statusCode !== 429 && __statusCode !== 403 &&__statusCode !== 508

? cb({
responseStatusCode: __statusCode,
})

: cb(null, {
meta: {},
message: `${options.provider || 'Publisher'} is rate-limiting. Meta disabled.`
})
}
};
7 changes: 6 additions & 1 deletion plugins/domains/facebook.com/facebook.thumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export default {
'facebook.video'
],

mixins: ['meta-fallback'],

getLink: function(url, __allowFBThumbnail, options, meta) {

var thumbnail = meta.twitter?.image
Expand Down Expand Up @@ -58,6 +60,8 @@ export default {
&& options.getProviderOptions('facebook.thumbnail', true) && !/comment_id=/.test(oembed.html)) {

options.followHTTPRedirect = true; // avoid security re-directs of URLs if any
options.exposeStatusCode = true;
options.provider = 'Facebook';

return {
__allowFBThumbnail: true
Expand All @@ -67,6 +71,7 @@ export default {

tests: [{
noFeeds: true,
skipMethods: ['getData', 'getLink']
skipMethods: ['getData', 'getLink'],
skipMixins: ['meta-fallback']
}]
};
4 changes: 2 additions & 2 deletions plugins/domains/facebook.com/facebook.video.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default {
/^https?:\/\/(?:www|business)\.facebook\.com\/video\.php.*[\?&]v=(\d+)(?:$|&)/i,
/^https?:\/\/(?:www|business)\.facebook\.com\/video\.php.*[\?&]id=(\d+)(?:$|&)/i,
/^https?:\/\/(?:www|business)\.facebook\.com\/[a-zA-Z0-9\.]+\/videos\/(?:[a-zA-Z0-9\-]+\/)?(\d+)/i,
/^https?:\/\/(?:www|business)\.facebook\.com\/watch\/?\?(?:.+&)?v=(\d+)/i
/^https?:\/\/(?:www|business)\.facebook\.com\/watch\/?\?(?:.+&)?v=(\d+)/i,
/^https?:\/\/(?:www|business)\.facebook\.com\/reel\/(\d+)/i
],

mixins: ["fb-error"],
Expand Down Expand Up @@ -51,7 +52,6 @@ export default {

tests: [
"http://www.facebook.com/video/video.php?v=4253262701205&set=vb.1574932468&type=2",
"http://www.facebook.com/photo.php?v=4253262701205&set=vb.1574932468&type=2&theater",
"https://business.facebook.com/KMPHFOX26/videos/10154356403004012/",
"https://www.facebook.com/sugarandsoulco/videos/1484037581637646/?pnref=story",
"https://www.facebook.com/watch/?v=235613163792499",
Expand Down

0 comments on commit df40642

Please sign in to comment.