Coder Social home page Coder Social logo

amirgi73 / fresh_script Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amcquade/fresh_script

0.0 1.0 0.0 19 KB

Find Spotify tracks posted to the HipHopHeads subreddit and add them to a Spotify playlist.

License: MIT License

Python 100.00%

fresh_script's Introduction

fresh_script

This program will search for spotify tracks posted in the HipHopHeads subreddit and add them to a playlist of your choice. HipHopHeads is a subreddit dedicated to everything hiphop, including the latest mixtapes, videos, news, and anything else hip hop related from your favorite artists.

Getting Started

Prerequisites

This project uses Python3. You will need to setup a Spotify developer account and register your app. You will need the following things for this code:

  • client id
  • client secret
  • your spotify username
  • playlist id of the playlist you want to add the tracks to
  • the url you want to redirect to for authentication, i.e. http://google.com/ You will also need to setup a reddit instance with praw. Heres a useful guide I used to do this.
pip3 install praw
pip3 install spotipy
pip3 install configparser

Running the script

Running the program is simple. The first time you run it, you will be asked for your Spotify credientials which will be saved to a config file for ease of use in the future. Choose to sort results by hot or new, enter a post limit, and then enjoy.

python fresh.py

Running the script using cron

We can use cron to automatically run the script periodically in order to keep it up-to-date. You will need either a macOS computer or Linux server to use cron.

  1. Follow the running the script instructions to make sure your .config.ini file is generated with the required parameters
  2. Run crontab -e to open the cron editor, which is similar to vim
  3. Use the following format to create a line for your cron
    * * * * * command to be executed
    - - - - -
    | | | | |
    | | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
    | | | ------- Month (1 - 12)
    | | --------- Day of month (1 - 31)
    | ----------- Hour (0 - 23)
    ------------- Minute (0 - 59)
    
    For example, you would do the following to run this everyday at 9AM
    0 9 * * * python /home/jsmith/fresh.py
    

Contributing

I appreciate any help and support. Feel free to fork and create a pull request

fresh_script's People

Contributors

amcquade avatar ondkloss avatar sapanpatel123 avatar sohilnandu avatar tonydelanuez avatar jb-delafosse avatar

Watchers

James Cloos 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.