yarliganfatih / Youtube-Live-Comments

MIT License
1 stars 0 forks source link

Reduce API Request #3

Open yarliganfatih opened 1 year ago

yarliganfatih commented 1 year ago
yarliganfatih commented 1 year ago

with RegEx

https://regexr.com/ https://regex101.com/

All Alternation

/0:00 |0:01 |0:02 |0:03 |0:04 |0:05 |0:06 |0:07 |0:08 |0:09 |0:10 |0:11 |0:12 |0:13 |0:14 |0:15 |0:16 |0:17 |0:18 |0:19 |0:20 |0:21 |0:22 |0:23 |0:24 |0:25 |0:26 |0:27 |0:28 |0:29 |0:30 |0:31 |0:32 |0:33 |0:34 |0:35 |0:36 |0:37 |0:38 |0:39 |0:40 |0:41 |0:42 |0:43 |0:44 |0:45 |0:46 |0:47 |0:48 |0:49 |0:50 |0:51 |0:52 |0:53 |0:54 |0:55 |0:56 |0:57 |0:58 |0:59 |1:00 |1:01 |1:02 |1:03 |1:04 |1:05 |1:06 |1:07 |1:08 |1:09 |1:10 |1:11 |1:12 |1:13 |1:14 |1:15 |1:16 |1:17 |1:18 |1:19 |1:20 |1:21 |1:22 |1:23 |1:24 |1:25 |1:26 |1:27 |1:28 |1:29 |1:30 |1:31 |1:32 |1:33 |1:34 |1:35 |1:36 |1:37 |1:38 |1:39 |1:40 |1:41 |1:42 |1:43 |1:44 |1:45 |1:46 |1:47 |1:48 |1:49 |1:50 ... /

with Complex Regex

/[0-9]:[0-5][0-9] /
/(0|1|2|3|4|5|6|7|8|9):(0|1|2|3|4|5)(0|1|2|3|4|5|6|7|8|9) /

Notes

yarliganfatih commented 1 year ago

searchTerms for textDisplay

searchTerms : \u003ca => totalResults : 0 searchTerms : \u003ca href="https://www.youtube.com/watch?v= => totalResults : 0

yarliganfatih commented 1 year ago

get All Comments from API and execute in javascript

This method has been tried before. https://anobjectisa.medium.com/youtube-pop-up-comments-chrome-extension-68e8d5a834ce

yarliganfatih commented 1 year ago

or Increase API quota

https://developers.google.com/search/apis/indexing-api/v3/quota-pricing https://support.google.com/youtube/contact/yt_api_form?hl=en

https://support.google.com/youtube/contact/yt_api_form?hl=en

https://developers.google.com/youtube/v3/guides/quota_and_compliance_audits?hl=tr https://developers.google.com/youtube/v3/determine_quota_cost?hl=tr

yarliganfatih commented 1 year ago

with middleware backend endpoint | with common database

function preCommentThreads ( videoId, page=1 ) {

}

pagination

In step 3, the number of requests can be greatly reduced by sending the request in 10 seconds searchTerms.

why 10 seconds, Can't the scale be bigger?

because of searchTerms accepts 100 char maximum. every second m:ss | should be in the form.

up-to-date

Let's say the comments of video X were saved to the database on date Y. Then for anyone watching the X video, comments saved on Y date will be returned from the database instead of sending a request to the Youtube Data API again. However, comments published after the Y date will not be displayed.

For this, a time period will be determined depending on the temperature of the video. In the 2nd stage, the updatedness of the last recorded comments will be checked and if they are out of date, the 3rd stage will be applied.

yarliganfatih commented 3 months ago

Sample Middleware restAPI project => https://github.com/yarliganfatih/placesmap-restapi