From 6fa9967426b84ba34bc0760ed8b94655cffa0a21 Mon Sep 17 00:00:00 2001 From: TrifanBogdan24 Date: Thu, 17 Oct 2024 16:13:44 +0300 Subject: [PATCH] Added tests --- .github/workflows/build.yaml | 0 .github/workflows/test.yaml | 40 +++++++++++++++++++++++++++++ README.md | 4 +++ Tests/URLs.txt | 20 +++++++++++++++ Tests/URLs/1.txt | 1 + Tests/URLs/10.txt | 1 + Tests/URLs/11.txt | 1 + Tests/URLs/12.txt | 1 + Tests/URLs/13.txt | 1 + Tests/URLs/14.txt | 1 + Tests/URLs/15.txt | 1 + Tests/URLs/16.txt | 1 + Tests/URLs/17.txt | 1 + Tests/URLs/18.txt | 1 + Tests/URLs/19.txt | 1 + Tests/URLs/2.txt | 1 + Tests/URLs/20.txt | 1 + Tests/URLs/3.txt | 1 + Tests/URLs/4.txt | 1 + Tests/URLs/5.txt | 1 + Tests/URLs/6.txt | 1 + Tests/URLs/7.txt | 1 + Tests/URLs/8.txt | 1 + Tests/URLs/9.txt | 1 + Tests/out/1.md | 24 ++++++++++++++++++ Tests/out/10.md | 24 ++++++++++++++++++ Tests/out/11.md | 24 ++++++++++++++++++ Tests/out/12.md | 24 ++++++++++++++++++ Tests/out/13.md | 24 ++++++++++++++++++ Tests/out/14.md | 24 ++++++++++++++++++ Tests/out/15.md | 24 ++++++++++++++++++ Tests/out/16.md | 24 ++++++++++++++++++ Tests/out/17.md | 24 ++++++++++++++++++ Tests/out/18.md | 24 ++++++++++++++++++ Tests/out/19.md | 24 ++++++++++++++++++ Tests/out/2.md | 24 ++++++++++++++++++ Tests/out/20.md | 24 ++++++++++++++++++ Tests/out/3.md | 24 ++++++++++++++++++ Tests/out/4.md | 24 ++++++++++++++++++ Tests/out/5.md | 24 ++++++++++++++++++ Tests/out/6.md | 24 ++++++++++++++++++ Tests/out/7.md | 24 ++++++++++++++++++ Tests/out/8.md | 24 ++++++++++++++++++ Tests/out/9.md | 24 ++++++++++++++++++ Tests/ref/1.md | 24 ++++++++++++++++++ Tests/ref/10.md | 24 ++++++++++++++++++ Tests/ref/11.md | 24 ++++++++++++++++++ Tests/ref/12.md | 24 ++++++++++++++++++ Tests/ref/13.md | 24 ++++++++++++++++++ Tests/ref/14.md | 24 ++++++++++++++++++ Tests/ref/15.md | 24 ++++++++++++++++++ Tests/ref/16.md | 24 ++++++++++++++++++ Tests/ref/17.md | 24 ++++++++++++++++++ Tests/ref/18.md | 24 ++++++++++++++++++ Tests/ref/19.md | 24 ++++++++++++++++++ Tests/ref/2.md | 24 ++++++++++++++++++ Tests/ref/20.md | 24 ++++++++++++++++++ Tests/ref/3.md | 24 ++++++++++++++++++ Tests/ref/4.md | 24 ++++++++++++++++++ Tests/ref/5.md | 24 ++++++++++++++++++ Tests/ref/6.md | 24 ++++++++++++++++++ Tests/ref/7.md | 24 ++++++++++++++++++ Tests/ref/8.md | 24 ++++++++++++++++++ Tests/ref/9.md | 24 ++++++++++++++++++ Tests/split_URLs.sh | 27 ++++++++++++++++++++ Tests/test.sh | 49 ++++++++++++++++++++++++++++++++++++ 66 files changed, 1120 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/test.yaml create mode 100644 Tests/URLs.txt create mode 100644 Tests/URLs/1.txt create mode 100644 Tests/URLs/10.txt create mode 100644 Tests/URLs/11.txt create mode 100644 Tests/URLs/12.txt create mode 100644 Tests/URLs/13.txt create mode 100644 Tests/URLs/14.txt create mode 100644 Tests/URLs/15.txt create mode 100644 Tests/URLs/16.txt create mode 100644 Tests/URLs/17.txt create mode 100644 Tests/URLs/18.txt create mode 100644 Tests/URLs/19.txt create mode 100644 Tests/URLs/2.txt create mode 100644 Tests/URLs/20.txt create mode 100644 Tests/URLs/3.txt create mode 100644 Tests/URLs/4.txt create mode 100644 Tests/URLs/5.txt create mode 100644 Tests/URLs/6.txt create mode 100644 Tests/URLs/7.txt create mode 100644 Tests/URLs/8.txt create mode 100644 Tests/URLs/9.txt create mode 100644 Tests/out/1.md create mode 100644 Tests/out/10.md create mode 100644 Tests/out/11.md create mode 100644 Tests/out/12.md create mode 100644 Tests/out/13.md create mode 100644 Tests/out/14.md create mode 100644 Tests/out/15.md create mode 100644 Tests/out/16.md create mode 100644 Tests/out/17.md create mode 100644 Tests/out/18.md create mode 100644 Tests/out/19.md create mode 100644 Tests/out/2.md create mode 100644 Tests/out/20.md create mode 100644 Tests/out/3.md create mode 100644 Tests/out/4.md create mode 100644 Tests/out/5.md create mode 100644 Tests/out/6.md create mode 100644 Tests/out/7.md create mode 100644 Tests/out/8.md create mode 100644 Tests/out/9.md create mode 100644 Tests/ref/1.md create mode 100644 Tests/ref/10.md create mode 100644 Tests/ref/11.md create mode 100644 Tests/ref/12.md create mode 100644 Tests/ref/13.md create mode 100644 Tests/ref/14.md create mode 100644 Tests/ref/15.md create mode 100644 Tests/ref/16.md create mode 100644 Tests/ref/17.md create mode 100644 Tests/ref/18.md create mode 100644 Tests/ref/19.md create mode 100644 Tests/ref/2.md create mode 100644 Tests/ref/20.md create mode 100644 Tests/ref/3.md create mode 100644 Tests/ref/4.md create mode 100644 Tests/ref/5.md create mode 100644 Tests/ref/6.md create mode 100644 Tests/ref/7.md create mode 100644 Tests/ref/8.md create mode 100644 Tests/ref/9.md create mode 100755 Tests/split_URLs.sh create mode 100755 Tests/test.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..0527f95 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,40 @@ +name: Python Workflow with Pytube + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Show Python and Pip versions + run: | + python3 --version + pip3 --version + + - name: Install Pytube + run: pip3 install pytube + + - name: Verify Pytube installation + run: pip3 freeze | grep 'pytube' + + - name: Run test script + run: | + cd Tests + ./test.sh + cd ../ + shell: bash + continue-on-error: false + + - name: Check exit code + if: ${{ failure() }} + run: echo "There was an error with the script execution!" diff --git a/README.md b/README.md index e35f549..4cfbd9f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Embed YouTube Card Generator +> **CLI** tool to create embedded YouTube cards for HTML/MarkDown projects. +> +> Bring your YouTube links to life! + 🚀 Glow up your HTML/Markdown files with this simple Python script! Just provide a YouTube URL as input, and it generates a sleek, clickable YouTube card for you. Perfect for embedding videos in your blog, documentation, or personal projects. diff --git a/Tests/URLs.txt b/Tests/URLs.txt new file mode 100644 index 0000000..b9e7d21 --- /dev/null +++ b/Tests/URLs.txt @@ -0,0 +1,20 @@ +https://youtu.be/gZx9yCbQg50 +https://youtu.be/gZx9yCbQg50?t=108 + +https://youtu.be/ByBGTkrQ-QU?list=PLfU9XN7w4tFzlLqAGhGMzrwv_QE782vbL +https://youtu.be/ByBGTkrQ-QU?list=PLfU9XN7w4tFzlLqAGhGMzrwv_QE782vbL&t=7 + +https://www.youtube.com/watch?v=4UcfECYbDYQ&index=1&list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl +https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl +https://www.youtube.com/watch?v=Svmor6ouuO4&index=4&list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl +https://www.youtube.com/watch?v=M44e92KoIaE +https://youtu.be/M44e92KoIaE +http://www.youtube.com/v/0zM3nApSvMg?fs=1&hl=en_US&rel=0 +http://www.youtube.com/embed/0zM3nApSvMg?rel=0 +http://www.youtube.com/watch?v=0zM3nApSvMg&feature=feedrec_grec_index +http://www.youtube.com/watch?v=0zM3nApSvMg +http://youtu.be/0zM3nApSvMg +http://youtu.be/dQw4w9WgXcQ +http://www.youtube.com/watch?feature=player_embedded&v=dQw4w9WgXcQ +https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl +https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl&t=51 diff --git a/Tests/URLs/1.txt b/Tests/URLs/1.txt new file mode 100644 index 0000000..e1bbe72 --- /dev/null +++ b/Tests/URLs/1.txt @@ -0,0 +1 @@ +https://youtu.be/gZx9yCbQg50 diff --git a/Tests/URLs/10.txt b/Tests/URLs/10.txt new file mode 100644 index 0000000..1ea06dc --- /dev/null +++ b/Tests/URLs/10.txt @@ -0,0 +1 @@ +https://www.youtube.com/watch?v=M44e92KoIaE diff --git a/Tests/URLs/11.txt b/Tests/URLs/11.txt new file mode 100644 index 0000000..a58244b --- /dev/null +++ b/Tests/URLs/11.txt @@ -0,0 +1 @@ +https://youtu.be/M44e92KoIaE diff --git a/Tests/URLs/12.txt b/Tests/URLs/12.txt new file mode 100644 index 0000000..e5d81f4 --- /dev/null +++ b/Tests/URLs/12.txt @@ -0,0 +1 @@ +http://www.youtube.com/v/0zM3nApSvMg?fs=1&hl=en_US&rel=0 diff --git a/Tests/URLs/13.txt b/Tests/URLs/13.txt new file mode 100644 index 0000000..157880a --- /dev/null +++ b/Tests/URLs/13.txt @@ -0,0 +1 @@ +http://www.youtube.com/embed/0zM3nApSvMg?rel=0 diff --git a/Tests/URLs/14.txt b/Tests/URLs/14.txt new file mode 100644 index 0000000..4995b17 --- /dev/null +++ b/Tests/URLs/14.txt @@ -0,0 +1 @@ +http://www.youtube.com/watch?v=0zM3nApSvMg&feature=feedrec_grec_index diff --git a/Tests/URLs/15.txt b/Tests/URLs/15.txt new file mode 100644 index 0000000..b79c21a --- /dev/null +++ b/Tests/URLs/15.txt @@ -0,0 +1 @@ +http://www.youtube.com/watch?v=0zM3nApSvMg diff --git a/Tests/URLs/16.txt b/Tests/URLs/16.txt new file mode 100644 index 0000000..6854148 --- /dev/null +++ b/Tests/URLs/16.txt @@ -0,0 +1 @@ +http://youtu.be/0zM3nApSvMg diff --git a/Tests/URLs/17.txt b/Tests/URLs/17.txt new file mode 100644 index 0000000..24843a3 --- /dev/null +++ b/Tests/URLs/17.txt @@ -0,0 +1 @@ +http://youtu.be/dQw4w9WgXcQ diff --git a/Tests/URLs/18.txt b/Tests/URLs/18.txt new file mode 100644 index 0000000..648930d --- /dev/null +++ b/Tests/URLs/18.txt @@ -0,0 +1 @@ +http://www.youtube.com/watch?feature=player_embedded&v=dQw4w9WgXcQ diff --git a/Tests/URLs/19.txt b/Tests/URLs/19.txt new file mode 100644 index 0000000..2939da0 --- /dev/null +++ b/Tests/URLs/19.txt @@ -0,0 +1 @@ +https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl diff --git a/Tests/URLs/2.txt b/Tests/URLs/2.txt new file mode 100644 index 0000000..8cb6d64 --- /dev/null +++ b/Tests/URLs/2.txt @@ -0,0 +1 @@ +https://youtu.be/gZx9yCbQg50?t=108 diff --git a/Tests/URLs/20.txt b/Tests/URLs/20.txt new file mode 100644 index 0000000..1e515b4 --- /dev/null +++ b/Tests/URLs/20.txt @@ -0,0 +1 @@ +https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl&t=51 diff --git a/Tests/URLs/3.txt b/Tests/URLs/3.txt new file mode 100644 index 0000000..d4b6c79 --- /dev/null +++ b/Tests/URLs/3.txt @@ -0,0 +1 @@ + diff --git a/Tests/URLs/4.txt b/Tests/URLs/4.txt new file mode 100644 index 0000000..6eecc3a --- /dev/null +++ b/Tests/URLs/4.txt @@ -0,0 +1 @@ +https://youtu.be/ByBGTkrQ-QU?list=PLfU9XN7w4tFzlLqAGhGMzrwv_QE782vbL diff --git a/Tests/URLs/5.txt b/Tests/URLs/5.txt new file mode 100644 index 0000000..04bb203 --- /dev/null +++ b/Tests/URLs/5.txt @@ -0,0 +1 @@ +https://youtu.be/ByBGTkrQ-QU?list=PLfU9XN7w4tFzlLqAGhGMzrwv_QE782vbL&t=7 diff --git a/Tests/URLs/6.txt b/Tests/URLs/6.txt new file mode 100644 index 0000000..39992a4 --- /dev/null +++ b/Tests/URLs/6.txt @@ -0,0 +1 @@ + diff --git a/Tests/URLs/7.txt b/Tests/URLs/7.txt new file mode 100644 index 0000000..26953c8 --- /dev/null +++ b/Tests/URLs/7.txt @@ -0,0 +1 @@ +https://www.youtube.com/watch?v=4UcfECYbDYQ&index=1&list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl diff --git a/Tests/URLs/8.txt b/Tests/URLs/8.txt new file mode 100644 index 0000000..2939da0 --- /dev/null +++ b/Tests/URLs/8.txt @@ -0,0 +1 @@ +https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl diff --git a/Tests/URLs/9.txt b/Tests/URLs/9.txt new file mode 100644 index 0000000..8ebdee7 --- /dev/null +++ b/Tests/URLs/9.txt @@ -0,0 +1 @@ +https://www.youtube.com/watch?v=Svmor6ouuO4&index=4&list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl diff --git a/Tests/out/1.md b/Tests/out/1.md new file mode 100644 index 0000000..84f5edb --- /dev/null +++ b/Tests/out/1.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 03:49 +
+
+
+ +

https://youtu.be/gZx9yCbQg50

+ +
+ +

SSH config basics

+
+
+ diff --git a/Tests/out/10.md b/Tests/out/10.md new file mode 100644 index 0000000..7e2eb9c --- /dev/null +++ b/Tests/out/10.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:30 +
+
+
+ +

https://www.youtube.com/watch?v=M44e92KoIaE

+ +
+ +

RAA - 'George Stuck' Insurance Ad

+
+
+ diff --git a/Tests/out/11.md b/Tests/out/11.md new file mode 100644 index 0000000..593c88c --- /dev/null +++ b/Tests/out/11.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:30 +
+
+
+ +

https://youtu.be/M44e92KoIaE

+ +
+ +

RAA - 'George Stuck' Insurance Ad

+
+
+ diff --git a/Tests/out/12.md b/Tests/out/12.md new file mode 100644 index 0000000..18c34fd --- /dev/null +++ b/Tests/out/12.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:16 +
+
+
+ +

http://www.youtube.com/v/0zM3nApSvMg?fs=1&hl=en_US&rel=0

+ +
+ +

Old Spice Pro-Strength Commercial - Neil Patrick Harris

+
+
+ diff --git a/Tests/out/13.md b/Tests/out/13.md new file mode 100644 index 0000000..ad608ba --- /dev/null +++ b/Tests/out/13.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:16 +
+
+
+ +

http://www.youtube.com/embed/0zM3nApSvMg?rel=0

+ +
+ +

Old Spice Pro-Strength Commercial - Neil Patrick Harris

+
+
+ diff --git a/Tests/out/14.md b/Tests/out/14.md new file mode 100644 index 0000000..bd3cf09 --- /dev/null +++ b/Tests/out/14.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:16 +
+
+
+ +

http://www.youtube.com/watch?v=0zM3nApSvMg&feature=feedrec_grec_index

+ +
+ +

Old Spice Pro-Strength Commercial - Neil Patrick Harris

+
+
+ diff --git a/Tests/out/15.md b/Tests/out/15.md new file mode 100644 index 0000000..8986b0d --- /dev/null +++ b/Tests/out/15.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:16 +
+
+
+ +

http://www.youtube.com/watch?v=0zM3nApSvMg

+ +
+ +

Old Spice Pro-Strength Commercial - Neil Patrick Harris

+
+
+ diff --git a/Tests/out/16.md b/Tests/out/16.md new file mode 100644 index 0000000..a81a4fe --- /dev/null +++ b/Tests/out/16.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:16 +
+
+
+ +

http://youtu.be/0zM3nApSvMg

+ +
+ +

Old Spice Pro-Strength Commercial - Neil Patrick Harris

+
+
+ diff --git a/Tests/out/17.md b/Tests/out/17.md new file mode 100644 index 0000000..30b1c04 --- /dev/null +++ b/Tests/out/17.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 03:32 +
+
+
+ +

http://youtu.be/dQw4w9WgXcQ

+ +
+ +

Never Gonna Give You Up

+
+
+ diff --git a/Tests/out/18.md b/Tests/out/18.md new file mode 100644 index 0000000..fde0470 --- /dev/null +++ b/Tests/out/18.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 03:32 +
+
+
+ +

http://www.youtube.com/watch?feature=player_embedded&v=dQw4w9WgXcQ

+ +
+ +

Never Gonna Give You Up

+
+
+ diff --git a/Tests/out/19.md b/Tests/out/19.md new file mode 100644 index 0000000..1d474e1 --- /dev/null +++ b/Tests/out/19.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 02:03 +
+
+
+ +

https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl

+ +
+ +

RAA Member Event - Adelaide United

+
+
+ diff --git a/Tests/out/2.md b/Tests/out/2.md new file mode 100644 index 0000000..a9e8945 --- /dev/null +++ b/Tests/out/2.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 03:49 +
+
+
+ +

https://youtu.be/gZx9yCbQg50?t=108

+ +
+ +

SSH config basics

+
+
+ diff --git a/Tests/out/20.md b/Tests/out/20.md new file mode 100644 index 0000000..40845fa --- /dev/null +++ b/Tests/out/20.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 02:03 +
+
+
+ +

https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl&t=51

+ +
+ +

RAA Member Event - Adelaide United

+
+
+ diff --git a/Tests/out/3.md b/Tests/out/3.md new file mode 100644 index 0000000..def1448 --- /dev/null +++ b/Tests/out/3.md @@ -0,0 +1,24 @@ + +
+ " target="_blank" style="display: block; position: relative;"> + + YouTube Thumbnail + +
+
+
+ +
+ 03:49 +
+
+
+ +

" target="_blank">

+ +
+ +

" target="_blank">SSH config basics

+
+
+ diff --git a/Tests/out/4.md b/Tests/out/4.md new file mode 100644 index 0000000..5319259 --- /dev/null +++ b/Tests/out/4.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 09:08 +
+
+
+ +

https://youtu.be/ByBGTkrQ-QU?list=PLfU9XN7w4tFzlLqAGhGMzrwv_QE782vbL

+ +
+ +

Unlock Git collaboration with CLONE, PUSH & FETCH

+
+
+ diff --git a/Tests/out/5.md b/Tests/out/5.md new file mode 100644 index 0000000..cabe19a --- /dev/null +++ b/Tests/out/5.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 09:08 +
+
+
+ +

https://youtu.be/ByBGTkrQ-QU?list=PLfU9XN7w4tFzlLqAGhGMzrwv_QE782vbL&t=7

+ +
+ +

Unlock Git collaboration with CLONE, PUSH & FETCH

+
+
+ diff --git a/Tests/out/6.md b/Tests/out/6.md new file mode 100644 index 0000000..462bc6d --- /dev/null +++ b/Tests/out/6.md @@ -0,0 +1,24 @@ + +
+ " target="_blank" style="display: block; position: relative;"> + + YouTube Thumbnail + +
+
+
+ +
+ 09:08 +
+
+
+ +

" target="_blank">

+ +
+ +

" target="_blank">Unlock Git collaboration with CLONE, PUSH & FETCH

+
+
+ diff --git a/Tests/out/7.md b/Tests/out/7.md new file mode 100644 index 0000000..d7328ee --- /dev/null +++ b/Tests/out/7.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 02:03 +
+
+
+ +

https://www.youtube.com/watch?v=4UcfECYbDYQ&index=1&list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl

+ +
+ +

RAA Member Event - Adelaide United

+
+
+ diff --git a/Tests/out/8.md b/Tests/out/8.md new file mode 100644 index 0000000..1d474e1 --- /dev/null +++ b/Tests/out/8.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 02:03 +
+
+
+ +

https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl

+ +
+ +

RAA Member Event - Adelaide United

+
+
+ diff --git a/Tests/out/9.md b/Tests/out/9.md new file mode 100644 index 0000000..e267827 --- /dev/null +++ b/Tests/out/9.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:30 +
+
+
+ +

https://www.youtube.com/watch?v=Svmor6ouuO4&index=4&list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl

+ +
+ +

RAA - 'George's Mower' Insurance Ad

+
+
+ diff --git a/Tests/ref/1.md b/Tests/ref/1.md new file mode 100644 index 0000000..84f5edb --- /dev/null +++ b/Tests/ref/1.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 03:49 +
+
+
+ +

https://youtu.be/gZx9yCbQg50

+ +
+ +

SSH config basics

+
+
+ diff --git a/Tests/ref/10.md b/Tests/ref/10.md new file mode 100644 index 0000000..7e2eb9c --- /dev/null +++ b/Tests/ref/10.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:30 +
+
+
+ +

https://www.youtube.com/watch?v=M44e92KoIaE

+ +
+ +

RAA - 'George Stuck' Insurance Ad

+
+
+ diff --git a/Tests/ref/11.md b/Tests/ref/11.md new file mode 100644 index 0000000..593c88c --- /dev/null +++ b/Tests/ref/11.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:30 +
+
+
+ +

https://youtu.be/M44e92KoIaE

+ +
+ +

RAA - 'George Stuck' Insurance Ad

+
+
+ diff --git a/Tests/ref/12.md b/Tests/ref/12.md new file mode 100644 index 0000000..18c34fd --- /dev/null +++ b/Tests/ref/12.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:16 +
+
+
+ +

http://www.youtube.com/v/0zM3nApSvMg?fs=1&hl=en_US&rel=0

+ +
+ +

Old Spice Pro-Strength Commercial - Neil Patrick Harris

+
+
+ diff --git a/Tests/ref/13.md b/Tests/ref/13.md new file mode 100644 index 0000000..ad608ba --- /dev/null +++ b/Tests/ref/13.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:16 +
+
+
+ +

http://www.youtube.com/embed/0zM3nApSvMg?rel=0

+ +
+ +

Old Spice Pro-Strength Commercial - Neil Patrick Harris

+
+
+ diff --git a/Tests/ref/14.md b/Tests/ref/14.md new file mode 100644 index 0000000..bd3cf09 --- /dev/null +++ b/Tests/ref/14.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:16 +
+
+
+ +

http://www.youtube.com/watch?v=0zM3nApSvMg&feature=feedrec_grec_index

+ +
+ +

Old Spice Pro-Strength Commercial - Neil Patrick Harris

+
+
+ diff --git a/Tests/ref/15.md b/Tests/ref/15.md new file mode 100644 index 0000000..8986b0d --- /dev/null +++ b/Tests/ref/15.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:16 +
+
+
+ +

http://www.youtube.com/watch?v=0zM3nApSvMg

+ +
+ +

Old Spice Pro-Strength Commercial - Neil Patrick Harris

+
+
+ diff --git a/Tests/ref/16.md b/Tests/ref/16.md new file mode 100644 index 0000000..a81a4fe --- /dev/null +++ b/Tests/ref/16.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:16 +
+
+
+ +

http://youtu.be/0zM3nApSvMg

+ +
+ +

Old Spice Pro-Strength Commercial - Neil Patrick Harris

+
+
+ diff --git a/Tests/ref/17.md b/Tests/ref/17.md new file mode 100644 index 0000000..30b1c04 --- /dev/null +++ b/Tests/ref/17.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 03:32 +
+
+
+ +

http://youtu.be/dQw4w9WgXcQ

+ +
+ +

Never Gonna Give You Up

+
+
+ diff --git a/Tests/ref/18.md b/Tests/ref/18.md new file mode 100644 index 0000000..fde0470 --- /dev/null +++ b/Tests/ref/18.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 03:32 +
+
+
+ +

http://www.youtube.com/watch?feature=player_embedded&v=dQw4w9WgXcQ

+ +
+ +

Never Gonna Give You Up

+
+
+ diff --git a/Tests/ref/19.md b/Tests/ref/19.md new file mode 100644 index 0000000..1d474e1 --- /dev/null +++ b/Tests/ref/19.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 02:03 +
+
+
+ +

https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl

+ +
+ +

RAA Member Event - Adelaide United

+
+
+ diff --git a/Tests/ref/2.md b/Tests/ref/2.md new file mode 100644 index 0000000..a9e8945 --- /dev/null +++ b/Tests/ref/2.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 03:49 +
+
+
+ +

https://youtu.be/gZx9yCbQg50?t=108

+ +
+ +

SSH config basics

+
+
+ diff --git a/Tests/ref/20.md b/Tests/ref/20.md new file mode 100644 index 0000000..40845fa --- /dev/null +++ b/Tests/ref/20.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 02:03 +
+
+
+ +

https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl&t=51

+ +
+ +

RAA Member Event - Adelaide United

+
+
+ diff --git a/Tests/ref/3.md b/Tests/ref/3.md new file mode 100644 index 0000000..def1448 --- /dev/null +++ b/Tests/ref/3.md @@ -0,0 +1,24 @@ + +
+ " target="_blank" style="display: block; position: relative;"> + + YouTube Thumbnail + +
+
+
+ +
+ 03:49 +
+
+
+ +

" target="_blank">

+ +
+ +

" target="_blank">SSH config basics

+
+
+ diff --git a/Tests/ref/4.md b/Tests/ref/4.md new file mode 100644 index 0000000..5319259 --- /dev/null +++ b/Tests/ref/4.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 09:08 +
+
+
+ +

https://youtu.be/ByBGTkrQ-QU?list=PLfU9XN7w4tFzlLqAGhGMzrwv_QE782vbL

+ +
+ +

Unlock Git collaboration with CLONE, PUSH & FETCH

+
+
+ diff --git a/Tests/ref/5.md b/Tests/ref/5.md new file mode 100644 index 0000000..cabe19a --- /dev/null +++ b/Tests/ref/5.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 09:08 +
+
+
+ +

https://youtu.be/ByBGTkrQ-QU?list=PLfU9XN7w4tFzlLqAGhGMzrwv_QE782vbL&t=7

+ +
+ +

Unlock Git collaboration with CLONE, PUSH & FETCH

+
+
+ diff --git a/Tests/ref/6.md b/Tests/ref/6.md new file mode 100644 index 0000000..462bc6d --- /dev/null +++ b/Tests/ref/6.md @@ -0,0 +1,24 @@ + +
+ " target="_blank" style="display: block; position: relative;"> + + YouTube Thumbnail + +
+
+
+ +
+ 09:08 +
+
+
+ +

" target="_blank">

+ +
+ +

" target="_blank">Unlock Git collaboration with CLONE, PUSH & FETCH

+
+
+ diff --git a/Tests/ref/7.md b/Tests/ref/7.md new file mode 100644 index 0000000..d7328ee --- /dev/null +++ b/Tests/ref/7.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 02:03 +
+
+
+ +

https://www.youtube.com/watch?v=4UcfECYbDYQ&index=1&list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl

+ +
+ +

RAA Member Event - Adelaide United

+
+
+ diff --git a/Tests/ref/8.md b/Tests/ref/8.md new file mode 100644 index 0000000..1d474e1 --- /dev/null +++ b/Tests/ref/8.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 02:03 +
+
+
+ +

https://youtu.be/4UcfECYbDYQ?list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl

+ +
+ +

RAA Member Event - Adelaide United

+
+
+ diff --git a/Tests/ref/9.md b/Tests/ref/9.md new file mode 100644 index 0000000..e267827 --- /dev/null +++ b/Tests/ref/9.md @@ -0,0 +1,24 @@ + +
+ + + YouTube Thumbnail + +
+
+
+ +
+ 0:30 +
+
+
+ +

https://www.youtube.com/watch?v=Svmor6ouuO4&index=4&list=PL1eC1aP-LYNg2ya1ywPj0pipd0y2EWGEl

+ +
+ +

RAA - 'George's Mower' Insurance Ad

+
+
+ diff --git a/Tests/split_URLs.sh b/Tests/split_URLs.sh new file mode 100755 index 0000000..d44832b --- /dev/null +++ b/Tests/split_URLs.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + +rm -rf URLs/ out/ +mkdir URLs/ out/ + + + +iter=0 + +# Read the file line by line +while IFS= read -r url ; do + iter=$(($iter+1)) + echo "$url" > "URLs/$iter.txt" + + # Give it more try. Pytube is not quite responsive. Might be prone to errors + for i in $(seq 1 10) ; do + python3 ../html_md_youtube_card.py "$url" 2> /dev/null 1> "ref/$iter.md" + if [[ $? == 0 ]] ; then + # If the script did not return an error code, exit the for + break + fi + done +done < URLs.txt + + + diff --git a/Tests/test.sh b/Tests/test.sh new file mode 100755 index 0000000..aeb4419 --- /dev/null +++ b/Tests/test.sh @@ -0,0 +1,49 @@ +#!/bin/bash + + +rm -rf out/ +mkdir out/ + +exit_code=0 +iter=0 + +# Read the file line by line +while IFS= read -r url ; do + iter=$(($iter+1)) + echo "$url" > "URLs/$iter.txt" + + + # Give it more try. Pytube is not quite responsive. Might be prone to errors + for i in $(seq 1 10) ; do + python3 ../html_md_youtube_card.py "$url" 2> /dev/null 1> "out/$iter.md" + if [[ $? == 0 ]] ; then + + nr_diff_lines=$(diff out/$iter.md ref/$iter.md > /dev/null | wc -l) + + if [[ $nr_diff_lines != 0 ]] ; then + exit_code=255 + echo "[ERROR] For URLs/$iter.txt, the command following command does not work:" + echo "$ python3 ../html_md_youtube_card.py " "$url" + diff "out/$iter.md" "ref/$iter.md" + echo '' + break + else + echo "[OK] URLs/$iter.txt" + fi + + # If the script did not return an error code, exit the for + break + fi + done +done < URLs.txt + + +echo '' + +if [[ $exit_code == 0 ]] ; then + echo "Great! All tests PASSED" +else + echo "Some tests FAILED :((" +fi + +exit $exit_code