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

Addition of comment export functionality (per video, as JSON, format example see in comment). #13

Closed
preai opened this issue May 25, 2019 · 10 comments

Comments

@preai
Copy link

preai commented May 25, 2019

[
  {
    "id": "UgzXyVGsIiMcZ9Bs-M54AaABAg",
    "user": "abc",
    "date": "4 days ago",
    "timestamp": 1558387486139,
    "commentText": "bla bla bla",
    "likes": 1,
    "hasReplies": true,
    "numberOfReplies": 2,
    "replies": [
      {
        "id": "UgzXyVGsIiMcZ9Bs-M54AaABAg.8vAG3f1HbIR8vARqlHhxyM",
        "user": "def",
        "date": "3 days ago",
        "timestamp": 1558473886511,
        "commentText": "@abc     ha ha ha",
        "likes": 0
      },
      {
        "id": "UgzXyVGsIiMcZ9Bs-M54AaABAg.8vAG3f1HbIR8vBliOzYonT",
        "user": "ghi",
        "date": "3 days ago",
        "timestamp": 1558473886512,
        "commentText": "@def --- no no no!.",
        "likes": 0
      }
    ]
  }
]
@preai preai changed the title Addition of Addition of comment export functionality (per video, as JSON, format example see in comment). May 25, 2019
@preai
Copy link
Author

preai commented May 25, 2019

As implemented here:

http://ytcomments.klostermann.ca/

@mattwright324
Copy link
Owner

I can see the value in having this functionality and is similarly something I have in my youtube-geofind web tool. This should be fairly simple to implement. I'll definitely look into adding this somehow.

@mattwright324
Copy link
Owner

I'm fairly close to finishing this though there are some caveats about the right behavior and wonder what you were expecting. I have two export modes, flattened (comments and replies on the same level like they appear in the app) and condensed (how they would appear from that example/site and on the YouTube site, where replies are in a list as part of a parent comment).

Flattened mode is great and easy haha.

Searching for "Comments and Replies" in YCS with default/no filters is how that site works and exporting results in condensed mode should result in almost the same thing.

However, you can't have condensed mode when you are searching "Comments Only" and "Replies Only", they would always have to be flattened. You could only export in condensed mode when searching both "Comments and Replies" because you kinda need both haha.

There is also the situation of a filtered query

  • A reply when the parent comment filtered out, leave at base level or omit from export file?
  • A parent comment with some or all replies filtered out, only show filtered ones if they fit the query? Show all replies regardless of query filters (similar to how 'view thread' works in app)?

@preai
Copy link
Author

preai commented Jun 25, 2019 via email

@mattwright324
Copy link
Owner

What if I we're to only allow condensed mode in ideal conditions which would satisfy what you've described is what you want?

  • Only condensed mode is available when "Comments and Replies" is used and Name Like & Text Like are empty?
  • Otherwise, flattened mode.

I'll note that currently condensed mode is also slower than flattened as it has to process comment threads (grab all comments in the thread) as they appear in the results list per video.

The folder structure when exporting will look like the following:

folder-where-ycs-is-located/
    youtube-comment-suite.jar
    {other files...}
    exports/
        {yyyy.MM.dd hh.mm.ss}/
            searchSettings.json
            videoId-meta.json
            videoId-comments.json

Following this structure, the generated export folder {yyyy.MM.dd hh.mm.ss}/ will have the date and time that the export button was pressed e.g. 2019.06.26 19.44.12/. The file searchSettings.json will give some context for what your Search Comments tab options were when exporing. All comments will be exported per-video as you've suggested in the format of videoId-meta.json describing the details of the video (id, title, description, published date, etc.) and videoId-comments which will be an array of all comments either in the condensed or flattened format.

@Trofaaa
Copy link

Trofaaa commented Jun 27, 2019

Sorry if I missed something; but could the channel ID also be included (which left the comment) along with the channel ID which uploaded the video please?

@mattwright324
Copy link
Owner

Yup, those fields are included per {videoId}-meta.json and per comment in each {videoId}-comments.json file.

@preai
Copy link
Author

preai commented Jun 27, 2019 via email

@mattwright324
Copy link
Owner

This has been mostly implemented in 073be22 on the replace-ytapi branch. Behaves as described in previous comments. There is still some testing and tweaking to do but it will be in the next release.

@DontBLB
Copy link

DontBLB commented Oct 17, 2019

Is it possible for there to be a function to export all comments as a CSV or excel please?

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

No branches or pull requests

4 participants