Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support YouTube Atom feed #43

Open
jezsung opened this issue Feb 16, 2021 · 2 comments
Open

Please support YouTube Atom feed #43

jezsung opened this issue Feb 16, 2021 · 2 comments

Comments

@jezsung
Copy link

jezsung commented Feb 16, 2021

YouTube supports the Atom feed for every channel. The below one is just an example and the structure of atom feeds are consistent.

Example:
https://www.youtube.com/feeds/videos.xml?channel_id=UCs5wAPodliO0oVxiTD8ruvg

Replace CHANNEL_ID with the channel you want
https://www.youtube.com/feeds/videos.xml?channel_id=CHANNEL_ID

I couldn't fetch the info under the <media:group>.

@niravanu
Copy link

niravanu commented Mar 16, 2021

group.dart

import 'package:webfeed/domain/media/category.dart';
import 'package:webfeed/domain/media/content.dart';
import 'package:webfeed/domain/media/credit.dart';
import 'package:webfeed/domain/media/rating.dart';
import 'package:webfeed/domain/media/thumbnail.dart';
import 'package:webfeed/domain/media/title.dart';
import 'package:webfeed/domain/media/description.dart';
import 'package:webfeed/domain/media/community.dart';
import 'package:webfeed/util/xml.dart';
import 'package:xml/xml.dart';

class Group {
  final Title? title;
  final List<Content>? contents;
  final List<Thumbnail>? thumbnails;
  final Description? description;
  final Community? community;
  final List<Credit>? credits;
  final Category? category;
  final Rating? rating;

  Group({
    this.title,
    this.contents,
    this.thumbnails,
    this.description,
    this.community,
    this.credits,
    this.category,
    this.rating,
  });

  static parse(XmlElement? element) {
    if (element == null) return null;
    return Group(
      title: Title.parse(
        findFirstElement(element, 'media:title'),
      ),
      contents: element.findElements('media:content').map((e) {
        return Content.parse(e);
      }).toList(),
      thumbnails: element.findElements('media:thumbnail').map((e) {
        return Thumbnail.parse(e);
      }).toList(),
      description: Description.parse(
        findFirstElement(element, 'media:description'),
      ),
      community: Community.parse(
        findFirstElement(element, 'media:community'),
      ),
      credits: element.findElements('media:credit').map((e) {
        return Credit.parse(e);
      }).toList(),
      category: Category.parse(
        findFirstElement(element, 'media:category'),
      ),
      rating: Rating.parse(
        findFirstElement(element, 'media:rating'),
      ),
    );
  }
}

@stefa98
Copy link

stefa98 commented Nov 26, 2021

Why does the new group.dart no longer have these elements? How do I add them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants