📗
Notes
  • Introduction
  • Files
  • Android
    • Http
      • Http基础
      • Okhttp理解
    • Jetpack
      • Notes
  • Java ways
    • 101
      • Basis
        • Index
        • Front
          • Angular
            • Angular start 01
            • Angular start 02
          • Typescript
            • Index
            • Ts 01
        • Java
          • Concurrency
          • Frameworks
            • Jdbc与连接池
            • Rxjava基础
            • Spring框架基础
          • Sugar&skill
        • Tool
          • Docker
            • Docker basis
            • Kubernetes play
          • Git
            • Git basic
          • Vim
            • Vim advance
      • Cs
        • Imp
          • Lru
          • Index
    • Snippets
      • Jpa和spring系列注解表
      • Java与oracle数据库各种操作
      • Maven初始化template
      • Nginx配置
      • Nginx反代后配置自动ssl续签
      • 终端033颜色
    • Ways
      • Java ways 01
      • Interview
        • Question
        • Requirements
      • Leetcode101
        • Acwing
          • Index
          • 背包问题
        • Explores
        • Solutions
          • Algorithms
            • Index
          • Concurrency
            • Index
          • Shell
            • Index
          • Sql
            • Index
  • Leecode
    • 牛客
      • 剑指offer
  • Play
    • Youtube离线下载
  • Python basic notes
    • Python days
Powered by GitBook
On this page
  • Youtube离线下载
  • 1.安装MediaDownloader
  • 2.配置rclone
  • 3.配置inotify
  • 4.安装任意一款OneDrive的index
  • 其他待完善

Was this helpful?

  1. Play

Youtube离线下载

Previous剑指offerNextPython days

Last updated 4 years ago

Was this helpful?

   Author: Gentleman.Hu
   Create Time: 2020-09-19 20:20:08
   Modified by: Gentleman.Hu
   Modified time: 2020-09-25 19:15:30
   Email: justfeelingme@gmail.com
   Home: https://crushing.xyz
   Description:

Youtube离线下载

1.安装MediaDownloader

2.配置rclone

3.配置inotify

  • 监测mp3文件生成

      #!/bin/bash
      TARGET='/www/wwwroot/be.feelingyou.ml/MediaDownloader/public/downloads'
      downloadpath='/www/wwwroot/be.feelingyou.ml/MediaDownloader/public/downloads'
    
      inotifywait -m --exclude "[^m][^p][^3]$" $TARGET -e create -e moved_to | \
          while read path action file; do
                  echo "The file '$file' appeared in directory '$TARGET' via '$action'"
              if [[ "$file" =~ .*temp.*$ ]]; then
                  echo "这是临时文件不上传"
              elif [[ "$file" =~ .*mp3$ ]]; then
                  /usr/bin/php /www/wwwroot/pan.i-love-you.ml/one.php upload:file "$TARGET/$file" /Youtube-dl/musics/
              fi
          done
  • 监测mp4

    #!/bin/bash
    TARGET='/www/wwwroot/be.feelingyou.ml/MediaDownloader/public/downloads'
    downloadpath='/www/wwwroot/be.feelingyou.ml/MediaDownloader/public/downloads'
    
    inotifywait -m --exclude "[^m][^p][^4]$" $TARGET -e create -e moved_to | \
        while read path action file; do
               echo "The file '$file' appeared in directory '$TARGET' via '$action'"
            if [[ "$file" =~ .*temp.*$ ]]; then
               echo "这是临时文件不上传"
            elif [[ "$file" =~ .*mp4$ ]]; then
                /usr/bin/php /www/wwwroot/pan.i-love-you.ml/one.php upload:file "$TARGET/$file" /Youtube-dl/videos/
            fi
        done
  • 监测webm

    #!/bin/bash
    TARGET='/www/wwwroot/be.feelingyou.ml/MediaDownloader/public/downloads'
    downloadpath='/www/wwwroot/be.feelingyou.ml/MediaDownloader/public/downloads'
    
    inotifywait -m --exclude "[^w][^e][^b][^m]$" $TARGET -e create -e moved_to | \
        while read path action file; do
                echo "The file '$file' appeared in directory '$TARGET' via '$action'"
            if [[ "$file" =~ .*temp.*$ ]]; then
                echo "这是临时文件不上传"
    #        if [[ "$file" =~ .f*.webm$ ]]; then
    #            echo "这是初始文件不上传"
            elif [[ "$file" =~ .*webm$ ]]; then
                /usr/bin/php /www/wwwroot/pan.i-love-you.ml/one.php upload:file "$TARGET/$file" /Youtube-dl/videos/
                rm -rf "$TARGET/$file"
            fi
        done
  • 监测mkv

    #!/bin/bash
    TARGET='/www/wwwroot/be.feelingyou.ml/MediaDownloader/public/downloads'
    downloadpath='/www/wwwroot/be.feelingyou.ml/MediaDownloader/public/downloads'
    
    inotifywait -m --exclude "[^m][^k][^v]$" $TARGET -e create -e moved_to | \
        while read path action file; do
               echo "The file '$file' appeared in directory '$TARGET' via '$action'"
            if [[ "$file" =~ .*temp.*mkv$ ]]; then
               echo "这是临时文件不上传"
            elif [[ "$file" =~ .f*.*mp4$ ]]; then
                echo "这是初始文件不上传"
            elif [[ "$file" =~ .*mkv$ ]]; then
                /usr/bin/php /www/wwwroot/pan.i-love-you.ml/one.php upload:file "$TARGET/$file" /Youtube-dl/videos/
                rm -rf "$TARGET/$file"
            fi
        done
    #inotifywait -m -e create -e moved_to --format "%f" $TARGET
    #    while read FILENAME; do
    #        #if [[ "$FILENAME" =~ .*mkv$ || "$FILENAME" =~ .*webm$ ]]; then
    #                #echo "mkv file"
    #            #filepath=$FILENAME
    #                #/usr/bin/php /www/wwwroot/pan.i-love-you.ml/one.php upload:file "$filepath" /Youtube-dl/videos/
    #                #rm -rf "$filepath"
    #                #exit 0
    #        #fi
    #   done
    
    # if [ $2 -eq 0 ]; then
    #     exit 0
    # fi
    # while true; do
    #     filepath=$path
    #     path=${path%/*}
    #     if [ "$path" = "$downloadpath" ] && [ $2 -eq 1 ]; then
    #         /usr/bin/php /www/wwwroot/pan.i-love-you.ml/one.php upload:file "$filepath" /upload/
    #         rm -rf "$filepath"
    #         exit 0
    #     elif [ "$path" = "$downloadpath" ]; then
    #         /usr/bin/php /www/wwwroot/pan.i-love-you.ml/one.php upload:folder "$filepath"/ /upload/"${filepath##*/}"/
    #         rm -rf "$filepath"/
    #         exit 0
    #     fi
    # done

    可能某些还未监测

  • 较完美监测

    #!/bin/bash
    TARGET='/root/tmp'
    downloadpath='/www/wwwroot/be.feelingyou.ml/MediaDownloader/public/downloads'
    
    inotifywait -m $TARGET -e create -e moved_to |
        while read path action file; do
            echo "The file '$file' appeared in directory '$TARGET' via '$action'"
            filename="${file##*/}"
            extension="${filename##*.}"
            case $extension in
            mp3)
                echo "$file"
                echo "$extension"
                ;;
            *)
                echo "$file"
                echo "$extension"
                ;;
            esac
        done

4.安装任意一款OneDrive的index

  • cuteone

  • oneindex

  • Olxdex?

  • pyone

  • ...

其他待完善

MediaDownloader