-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
130 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: 'Build and release' | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
build: | ||
name: 'Build the project' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag-name: ${{ steps.tag.outputs.tag }} | ||
steps: | ||
- name: 'Checkout Code' | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: master | ||
- name: 'Set up Java' | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: 11 | ||
distribution: temurin | ||
cache: 'gradle' | ||
- name: 'Build shadow jar' | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: shadowJar | ||
- name: 'Upload Artifacts' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: artifacts | ||
path: ./build/libs/*-all.jar | ||
- name: 'export version number' | ||
id: tag | ||
run: ./gradlew properties -q | grep "version:" | awk '{ print "::set-output name=tag::"$2 }' | ||
|
||
release-content: | ||
name: 'Create GitHub Release' | ||
runs-on: ubuntu-latest | ||
needs: [ build ] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: 'Download Artifacts' | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: artifacts | ||
- name: 'Create GitHub Release' | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: ./* | ||
tag_name: ${{needs.build.outputs.tag-name}} | ||
name: version v${{needs.build.outputs.tag-name}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
# What is it? | ||
This app shows your youtube history, grouped by months and sorted by watch count | ||
This app shows your YouTube history, grouped by months and sorted by watch count | ||
|
||
# Instructions | ||
|
||
1. git clone or download and extract project | ||
2. Go to [google takeout page](https://takeout.google.com/settings/takeout), deselect everything except *YouTube and YouTube Music*. | ||
3. Under *YouTube and YouTube Music* click on *Multiple formats* and change history type from html to json | ||
4. Under *YouTube and YouTube Music* click on *All YouTube data included* and deselect everything except history | ||
5. click next step, choose your method and download files | ||
6. Install Java 11 and make sure JAVA_HOME is set | ||
7. extract `watch-history.json` file into projects directory `/src/main/resources/watch-history.json` | ||
8. If you are on linux open console in projects root directory and execute `./gradlew run` | ||
9. If you are on windows open cmd in projects root directory and execute `gradlew.bat run` | ||
10. The output from the program is MD formatted, you can copy&paste it in your repo on Github or in Notion. | ||
1. Go to [google takeout page](https://takeout.google.com/settings/takeout), deselect everything except *YouTube and | ||
YouTube Music*. | ||
2. Under *YouTube and YouTube Music* click on *Multiple formats* and change history type from html to json | ||
3. Under *YouTube and YouTube Music* click on *All YouTube data included* and deselect everything except history | ||
4. click next step, choose your method and download files | ||
5. Install Java 11 and make sure JAVA_HOME is set | ||
6. Download .jar file from the Releases page and run it with `java -jar youtube-history-all.jar watch-history.json` | ||
7. The output from the program is MD formatted, you can copy&paste it in your repo on Github or in Notion. | ||
|
||
# Recover removed videos | ||
- you can use google to find video name by url. Then search the name and you will find many similar videos | ||
- these websites maybe helpful: [quiteaplaylist](https://quiteaplaylist.com) and [this post on archivarix](https://archivarix.com/en/blog/download-deleted-youtube-videos/) | ||
|
||
- Search deleted video url with Google. You will find many other similar videos. | ||
- these websites maybe helpful: [quiteaplaylist](https://quiteaplaylist.com) | ||
and [this post on archivarix](https://archivarix.com/en/blog/download-deleted-youtube-videos/) | ||
|
||
# Build from source | ||
|
||
clone the repository and in the project directory run `./gradlew shadowjar` | ||
then inside `build/libs` folder should be a jar file which you can run | ||
with `java -jar filename-all.jar history.json` | ||
|
||
# this is what it looks like | ||
|
||
![image](https://user-images.githubusercontent.com/22417494/124386451-89aa5980-dceb-11eb-8cd3-1d8fec57ad9a.png) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
|
||
rootProject.name = "Youtube_history_parser" | ||
|
||
rootProject.name = "Youtube_history_parser" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,42 @@ | ||
import models.YoutubeHistory | ||
import picocli.CommandLine | ||
import java.io.File | ||
import java.util.concurrent.Callable | ||
import kotlin.system.exitProcess | ||
|
||
fun main() { | ||
val youtubeHistory = YoutubeHistory(resourcePath = "/watch-history.json", minVideoClicks = 10) | ||
@CommandLine.Command( | ||
name = "Youtube History", | ||
mixinStandardHelpOptions = true, | ||
version = ["1.0.0"], | ||
description = ["Prints the statistics of your videos in a Markdown format"] | ||
) | ||
class CLI : Callable<Int> { | ||
|
||
val results = StringBuilder().apply { | ||
append("# TOP 10") | ||
appendLine() | ||
append("### " + youtubeHistory.totalTimeWatchedForTopTenVideos()) | ||
appendLine() | ||
append(youtubeHistory.getTopTenVideos()) | ||
appendLine() | ||
append("### " + youtubeHistory.totalTimeWatched()) | ||
appendLine() | ||
append(youtubeHistory.getMusicHistory()) | ||
} | ||
@CommandLine.Parameters(description = ["File containing the history"]) | ||
lateinit var historyJsonFile: File | ||
|
||
override fun call(): Int { | ||
|
||
val youtubeHistory = YoutubeHistory( | ||
resourcePath = historyJsonFile, | ||
minVideoClicks = 0 | ||
) | ||
|
||
println(results) | ||
val results = StringBuilder().apply { | ||
append("# TOP 10") | ||
appendLine() | ||
append("### " + youtubeHistory.totalTimeWatchedForTopTenVideos()) | ||
appendLine() | ||
append(youtubeHistory.getTopTenVideos()) | ||
appendLine() | ||
append("### " + youtubeHistory.totalTimeWatched()) | ||
appendLine() | ||
append(youtubeHistory.getMusicHistory()) | ||
} | ||
|
||
println(results) | ||
return 0 | ||
} | ||
} | ||
|
||
fun main(args: Array<String>): Unit = exitProcess(CommandLine(CLI()).execute(*args)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters