Coder Social home page Coder Social logo

bagasstrongman / match-youtube-title-with-view-count Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andeyashwanth/match-youtube-title-with-view-count

0.0 2.0 0.0 2 KB

Updates youtube video view count to match the title.

Home Page: https://www.youtube.com/watch?v=ScIe7InaRJI

PHP 100.00%

match-youtube-title-with-view-count's Introduction

clone the repo and run composer install to install googleapi and dotenv(optional).

create a project in google developer console and add youtube data api v3.

You also need to enable OAuth in dev console.

Edit video_id(line 11)(obtained from url of video), api_key(line 12)(obtained from google developer console) and application name(line 15) in main.php.

Download client_secret.json form google developer console and place in same(current) directory.

Open get_auth_code.php file in browser after starting apache2 or xampp.

open the url in new tab and authorise your account to your app.

copy the authorization code from the url to main.php(line 13) and open in browser or run in commandline.

Access token and refresh token along with some metadata like created time and expiry will be stored in accesstoken.json.

views, likes and comments count will be stored in count.json.

If the counts obtained by fetching using yotube data api are different from previously saved count.json then script updates the title.

Run cron job every minute or 30 seconds or how frequently you want depending on your size of audience and quota limit for requests.
crontab -e
add * * * * * /usr/bin/php path/to/main.php at the end of file.

Code obtained from youtube data api v3 docs.

Below video demonstrates working of this script.

https://www.youtube.com/watch?v=ScIe7InaRJI

match-youtube-title-with-view-count's People

Contributors

andeyashwanth avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.