Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit c899826

Browse files
Changes made to the api to be compatible with railway infastructure
1 parent 00a6fff commit c899826

File tree

5 files changed

+17
-23
lines changed

5 files changed

+17
-23
lines changed
-7 Bytes
Binary file not shown.

db.sqlite3

Whitespace-only changes.

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ python-slugify==1.1.4
5252
six==1.16.0
5353
Unidecode==1.3.6
5454
websockets==11.0.3
55-
yt-dlp==2023.7.6
-527 Bytes
Binary file not shown.

rewards/views.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from django.utils import timezone as django_timezone
1414
from .serializers import QuestionSerializer, QuizApiSerializer, QuizSerializer, MonsterHunterSerializer
1515
from .models import Subject, Quiz, Questions
16-
import yt_dlp as youtube_dl
16+
1717

1818
User = get_user_model()
1919

@@ -435,27 +435,22 @@ def get(self, request):
435435

436436
# Get the unwatched video URLs based on the user's country
437437
unwatched_urls = zolo_videos.get_videos_by_country()
438-
439-
# Get the streaming URL for each video URL
440-
stream_urls = [get_stream_url(url) for url in unwatched_urls]
441-
442-
# Return your response or render the template with the stream URLs
443-
return Response({"urls": stream_urls}, status=status.HTTP_200_OK)
444-
445-
446-
def get_stream_url(video_url):
447-
# Create youtube_dl options dictionary
448-
ydl_opts = {
449-
'format': 'best',
450-
'quiet': True
451-
}
452-
453-
# Create youtube_dl extractor
454-
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
455-
info_dict = ydl.extract_info(video_url, download=False)
456-
stream_url = info_dict['url']
457-
458-
return stream_url
438+
return Response({"urls": unwatched_urls}, status=status.HTTP_200_OK)
439+
440+
441+
# def get_stream_url(video_url):
442+
# # Create youtube_dl options dictionary
443+
# ydl_opts = {
444+
# 'format': 'best',
445+
# 'quiet': True
446+
# }
447+
#
448+
# # Create youtube_dl extractor
449+
# with youtube_dl.YoutubeDL(ydl_opts) as ydl:
450+
# info_dict = ydl.extract_info(video_url, download=False)
451+
# stream_url = info_dict['url']
452+
#
453+
# return stream_url
459454

460455

461456
class ZoloVideoApi(APIView):

0 commit comments

Comments
 (0)