youtube.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef YOUTUBE_H
  2. #define YOUTUBE_H
  3. #include <sys/types.h>
  4. #include "network.h"
  5. typedef struct media_info
  6. {
  7. unsigned short itag;
  8. unsigned short fps;
  9. const char* quality;
  10. const char* container;
  11. const char* codec;
  12. _Bool video;
  13. _Bool audio;
  14. unsigned short audio_bitrate; /* kbit/s */
  15. char* url;
  16. } media_info;
  17. typedef struct media_list
  18. {
  19. media_info** mi;
  20. unsigned count;
  21. } media_list;
  22. typedef struct video_info
  23. {
  24. char* id;
  25. char* title;
  26. char* author;
  27. char* channel_id;
  28. char* length;
  29. char* views;
  30. char* description;
  31. media_list* ml;
  32. } video_info;
  33. typedef struct video_list
  34. {
  35. video_info** vi;
  36. unsigned count;
  37. } video_list;
  38. /* table is located in youtube.c */
  39. extern const media_info const itag_table[];
  40. extern const size_t itag_table_count;
  41. video_list* get_playlist(char const* id);
  42. video_list* search_request(char* search, unsigned pnum);
  43. video_info* get_video_info(char* id);
  44. char* video_id_from_url(const char* url);
  45. void free_video_info(video_info* info);
  46. void free_media_info(media_info* info);
  47. void free_video_list(video_list* vl);
  48. void free_media_list(media_list* ml);
  49. #endif // YOUTUBE_H