mirror of
https://github.com/JoseDeFreitas/awesome-youtubers.git
synced 2025-01-03 03:20:48 -05:00
Update tests
This commit is contained in:
parent
64cb2816cc
commit
d5b623991a
@ -1 +1 @@
|
|||||||
web: gunicorn api:app
|
web: gunicorn main:app
|
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"Tech_With_Tim": 0,
|
"Tech_With_Tim": 11,
|
||||||
"Derek_Banas": 0,
|
"Derek_Banas": 0,
|
||||||
"Don_Jones": 0,
|
"Don_Jones": 0,
|
||||||
"Corey_Schafer": 0,
|
"Corey_Schafer": 0,
|
||||||
"Brian_Will": 0,
|
"Brian_Will": 0,
|
||||||
"LearningLad": 0,
|
"LearningLad": -7,
|
||||||
"David_Bombal": 0,
|
"David_Bombal": 0,
|
||||||
"Ben_Eater": 0,
|
"Ben_Eater": 0,
|
||||||
"The_Coding_Train": 0,
|
"The_Coding_Train": 0,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import json
|
import json
|
||||||
from datetime import datetime
|
|
||||||
from flask import Flask, jsonify, make_response, request
|
from flask import Flask, jsonify, make_response, request
|
||||||
from flask_limiter import Limiter
|
from flask_limiter import Limiter
|
||||||
from flask_limiter.util import get_remote_address
|
from flask_limiter.util import get_remote_address
|
||||||
@ -53,11 +52,6 @@ def get_channel(channel):
|
|||||||
with open("data.json", "w", encoding="utf8") as write_data:
|
with open("data.json", "w", encoding="utf8") as write_data:
|
||||||
json.dump(channels, write_data, indent=4)
|
json.dump(channels, write_data, indent=4)
|
||||||
|
|
||||||
# Write to log file.
|
|
||||||
with open("log.txt", "a") as append:
|
|
||||||
today = datetime.today().strftime('%Y-%m-%d-%H:%M')
|
|
||||||
append.write(f"\n{vote.title()}d {channel} on {today}")
|
|
||||||
|
|
||||||
return f"You {vote}d successfully the channel {channel}."
|
return f"You {vote}d successfully the channel {channel}."
|
||||||
else:
|
else:
|
||||||
return "Channel not found on the list."
|
return "Channel not found on the list."
|
||||||
@ -72,7 +66,8 @@ def get_channel(channel):
|
|||||||
def img_channel(channel):
|
def img_channel(channel):
|
||||||
""" Returns the YouTube score in a svg image. """
|
""" Returns the YouTube score in a svg image. """
|
||||||
|
|
||||||
svg_image = f"""
|
if channel in channels:
|
||||||
|
svg_image = f"""
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||||
width="52px" height="22px" viewBox="0 0 52 22" fill="none">
|
width="52px" height="22px" viewBox="0 0 52 22" fill="none">
|
||||||
<style>
|
<style>
|
||||||
@ -90,7 +85,6 @@ def img_channel(channel):
|
|||||||
</svg>
|
</svg>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if channel in channels:
|
|
||||||
response = make_response(svg_image)
|
response = make_response(svg_image)
|
||||||
response.headers.set('Content-Type', 'image/svg+xml')
|
response.headers.set('Content-Type', 'image/svg+xml')
|
||||||
return response
|
return response
|
||||||
@ -99,4 +93,4 @@ def img_channel(channel):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run()
|
app.run(debug=True)
|
@ -32,4 +32,4 @@ video quality, coverage of the topics it explains, among others), but, of course
|
|||||||
so I think being able to receive opinions from all users is a good way to filter and have truly
|
so I think being able to receive opinions from all users is a good way to filter and have truly
|
||||||
awesome content based on the community's opinion.
|
awesome content based on the community's opinion.
|
||||||
|
|
||||||
<img src="127.0.0.1:5000/channels/LearningLad/image.svg">
|
<img src="http://127.0.0.1:5000/channels/Tech_With_Tim/image.svg">
|
Loading…
Reference in New Issue
Block a user