Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
Allow amplify_video urls in regex
Browse files Browse the repository at this point in the history
  • Loading branch information
MateusAquino committed Dec 31, 2020
1 parent 5a9edc4 commit 96d54d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/controllers/Recognitions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const statusHashRgx = /video\/([^\/]+)(?:\/[^\/]+){3}\/([^\/?]+)/;
const statusHashRgx = /video\/([^\/]+)(?:\/[^\/]+){2,3}\/([^\/?]+)/;
const Recognitions = require('../models/Recognitions');

class RecognitionsController {
Expand Down
1 change: 0 additions & 1 deletion src/recognition/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ main = async () => {
return twitter.replyTo(id, screenName, `twitter.com/me/status/${setRecognized}`);

// Download Media
console.log('------ New Identification in progress... (twid: ' + tweet.id_str + ') ------')
let tempFile = await download(mediaURL);
if (tempFile === false) return console.log('Couldn\'t download media');

Expand Down
6 changes: 4 additions & 2 deletions src/recognition/utils/twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ class Twitter {
const mediaURL = tweet.extended_entities.media[0].video_info.variants[0].url;
for (let media of tweet.extended_entities.media[0].video_info.variants)
if (media.content_type === 'video/mp4') {
console.log('x - '+media.url)
console.log('------ New Identification in progress... (twid: '+id+') ------');
console.log('Media URL: ' + media.url)
return media.url;
}
console.log('y - '+mediaURL)
console.log('------ New Identification in progress... (twid: '+id+') ------');
console.log('Media URL (fallback): ' + mediaURL)
return mediaURL;
}

Expand Down

0 comments on commit 96d54d9

Please sign in to comment.