Coder Social home page Coder Social logo

pupiltong / twitter-summarizer-rest-service-pupiltong Goto Github PK

View Code? Open in Web Editor NEW

This project forked from buec500c1/twitter-summarizer-rest-service-pupiltong

0.0 0.0 0.0 16.14 MB

twitter-summarizer-rest-service-PupilTong created by GitHub Classroom

Python 74.03% JavaScript 10.66% HTML 4.62% Vue 10.69%

twitter-summarizer-rest-service-pupiltong's Introduction

Twitter hashtag photo video summary generator - Restful Api Version

Feel CRAZY about the FOOLISH CORS POLICY AND NGINX MANUAL

use

add_header Access-Control-Allow-Origin '*' always;

TO ADD A 'ALLOW ALL' Header on your response

like this:

server {

        server_name hw5.onic.xyz;
        location / {
        add_header Access-Control-Allow-Origin '*' always;
        proxy_pass http://127.0.0.1:6666;
        proxy_http_version 1.1;
        proxy_set_header   Host $host;
        proxy_set_header Content-Type 'application/json';
        }

listen 80;
}

AND DONT FORGET ADDING 'always' IN THE END

Offical and popular instructions never told u.

requirement

python > 3.6

ffmpeg

Api Definition

Start a task

curl -i -H "Content-Type: application/json" -X POST -d '{"keyword":"book"}' http://hw5.onic.xyz/

return

{
 "uuid": "3f3d3fb0-b175-4a58-b8ec-9923813d0505", 
 "get_status": "http://hw5.onic.xyz/status/3f3d3fb0-b175-4a58-b8ec-9923813d0505", 
 "get_video": "http://hw5.onic.xyz/video/3f3d3fb0-b175-4a58-b8ec-9923813d0505"
}

Check status

curl -i -X GET http://hw5.onic.xyz/status/3f3d3fb0-b175-4a58-b8ec-9923813d0505

return

{
 "uuid": "3f3d3fb0-b175-4a58-b8ec-9923813d0505", 
 "percentage": -1, 
 "status": "finished/doesnt exist"
}

Get Video

curl -i -X GET http://hw5.onic.xyz/video/3f3d3fb0-b175-4a58-b8ec-9923813d0505

return

file it self

Deployment Guide

Environment Configuration

git clone http://github.com/BUEC500C1/video-PupilTong.git
cd video-PupilTong
pip3 install -r requirements.txt
python3 rest.py

import your own Twitter API key info

Keys should be stores in 'key file:

[auth]
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""

Too Old;DR

Module ffmpegQueue.py

This module is able to convert a tuple of texts and a tuple of images' url to a summary video.

Architechture

Architechture

Class queueItem

One task of the work load pool

Constructor Parameters

Name Description type
directory Output video storage directory str
text List of texts tuple
img Images list for each text. Program will use the first as the background tuple
keyword keyword of this task, will use this to create a temp directory. Program will try to delete the directory first str

Class VideoApi

video processing core

Method AddTask

Name Description type
item the task to be added to the workload pool ququeItem
return

return a unique uuid of this task.

Method CheckStatus

Check current task status.

return

type: int

# 0 - unstart
# 1~99 - processing
# 100 - finished
# -1 - deleted

Module TwitterVideoSum.py

This module is able to pull tweets from twitter with provided parmeters and prepare data for Module ffmpegQueue

Architechture

Architechture

Class TwitterVideoSum:

Constructor

Name Description type
consumer_key twitter api key str
consumer_secret twitter api key str
access_token twitter api key str
access_token_secret twitter api key str
keywords List of hashtags tuple
directory video storage directory str
item number of photos for each hashtag to be converted str

Method Start

Start the process

twitter-summarizer-rest-service-pupiltong's People

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.