使用下载为html文件的站点中的数据重命名视频文件

时间:2016-03-28 17:06:32

标签: java html file streamreader

我只是开始进入编程,所以这个想法遗憾地超出了我目前的能力。

我从网站上抓取了一些流,以便在我的电脑或手机上离线观看视频文件。大多数文件已经有了正确的名称,但是我想根据它们的年表/章节按照正确的顺序排列它们,因为按创建日期排序不起作用,因为流下载器一次创建了多个文件。

这是“表格”的屏幕截图,其中包含正确的文件排列。 http://prntscr.com/al5yoe

为了将它们按正确的顺序排列,我保存了源自流的网页作为html文件,希望数据有助于解决我的问题。 这是一个课程的文件夹的样子(是的,我有多个,所以文件安排/重命名也应该适用于不同的文件) http://prntscr.com/al63qn

以下是我认为一个示例课程的html的一些重要部分(运行片段已经关闭) 如果您需要完整的网站html,请通知我,因为这只是我认为最重要的解决问题的摘录:

 <h4 class="ga" data-ga-action="click" data-ga-label="toc-chapter" data-ga-value="388286">Introduction</h4>
</div>
</div>
<ul class="row toc-items container-fade-bottom">
  <li data-video-id="388287" class="toc-video-item current" role="presentation" data-item-id="388287" data-item-type="video">
    <div class="row video-row">
      <div class="col-xs-11 video-name-cont">
        <i class="ga lyndacon booker bookmark-outline" data-bookmark-id=""></i>
        <a href="http://www.lynda.com/3ds-Max-tutorials/Welcome/373552/388287-4.html" class="item-name video-name ga" role="listitem" data-ga-action="click" data-ga-label="toc-video" data-ga-value="388287">
                                        Welcome
                                    </a>
        <div>
          <span class="video-duration">1m 6s</span>
        </div>
      </div>
      <div class="col-xs-1 video-actions-cont">
        <i class="ga watch-trigger popover-trigger lyndacon eye" data-videoid="388287" data-ga-action="click" data-ga-label="toc-video-eye" data-ga-value="388287"></i>
      </div>
    </div>
  </li>
  <li data-video-id="388288" class="toc-video-item" role="presentation" data-item-id="388288" data-item-type="video">
    <div class="row video-row">
      <div class="col-xs-11 video-name-cont">
        <i class="ga lyndacon booker bookmark-outline" data-bookmark-id=""></i>
        <a href="http://www.lynda.com/3ds-Max-tutorials/Using-exercise-files/373552/388288-4.html" class="item-name video-name ga" role="listitem" data-ga-action="click" data-ga-label="toc-video" data-ga-value="388288">
                                        Using the exercise files
                                    </a>
        <div>
          <span class="video-duration">1m 4s</span>
        </div>
      </div>
      <div class="col-xs-1 video-actions-cont">
        <i class="ga watch-trigger popover-trigger lyndacon" data-videoid="388288" data-ga-action="click" data-ga-label="toc-video-eye" data-ga-value="388288"></i>
      </div>
    </div>
  </li>
</ul>
</li>
<li role="presentation">
  <div class="row chapter-row">
    <div class="col-xs-12" role="treeitem">
      <i class="lyndacon caret-grey chapter-caret ga" data-ga-action="click" data-ga-label="toc-chapter-caret" data-ga-value="388289"></i>
      <h4 class="ga" data-ga-action="click" data-ga-label="toc-chapter" data-ga-value="388289">1. Getting Started</h4>
    </div>
  </div>
  <ul class="row toc-items container-fade-bottom">
    <li data-video-id="388290" class="toc-video-item" role="presentation" data-item-id="388290" data-item-type="video">
      <div class="row video-row">
        <div class="col-xs-11 video-name-cont">
          <i class="ga lyndacon booker bookmark-outline" data-bookmark-id=""></i>
          <a href="http://www.lynda.com/3ds-Max-tutorials/Using-project-folders/373552/388290-4.html" class="item-name video-name ga" role="listitem" data-ga-action="click" data-ga-label="toc-video" data-ga-value="388290">
                                        Using project folders
                                    </a>
          <div>
            <span class="video-duration">4m</span>
          </div>
        </div>
        <div class="col-xs-1 video-actions-cont">
          <i class="ga watch-trigger popover-trigger lyndacon" data-videoid="388290" data-ga-action="click" data-ga-label="toc-video-eye" data-ga-value="388290"></i>
        </div>
      </div>
    </li>
    <li data-video-id="388291" class="toc-video-item" role="presentation" data-item-id="388291" data-item-type="video">
      <div class="row video-row">
        <div class="col-xs-11 video-name-cont">
          <i class="ga lyndacon booker bookmark-outline" data-bookmark-id=""></i>
          <a href="http://www.lynda.com/3ds-Max-tutorials/Customize-user-interface-defaults/373552/388291-4.html" class="item-name video-name ga" role="listitem" data-ga-action="click" data-ga-label="toc-video" data-ga-value="388291">
                                        Customize user interface and defaults
                                    </a>
          <div>
            <span class="video-duration">4m 4s</span>
          </div>
        </div>
        <div class="col-xs-1 video-actions-cont">
          <i class="ga watch-trigger popover-trigger lyndacon" data-videoid="388291" data-ga-action="click" data-ga-label="toc-video-eye" data-ga-value="388291"></i>
        </div>
      </div>
    </li>
    <li data-video-id="388292" class="toc-video-item" role="presentation" data-item-id="388292" data-item-type="video">
      <div class="row video-row">
        <div class="col-xs-11 video-name-cont">
          <i class="ga lyndacon booker bookmark-outline" data-bookmark-id=""></i>
          <a href="http://www.lynda.com/3ds-Max-tutorials/Setting-preferences/373552/388292-4.html" class="item-name video-name ga" role="listitem" data-ga-action="click" data-ga-label="toc-video" data-ga-value="388292">
                                        Setting preferences
                                    </a>
          <div>
            <span class="video-duration">4m 58s</span>
          </div>
        </div>
        <div class="col-xs-1 video-actions-cont">
          <i class="ga watch-trigger popover-trigger lyndacon" data-videoid="388292" data-ga-action="click" data-ga-label="toc-video-eye" data-ga-value="388292"></i>
        </div>
      </div>
    </li>
  </ul>
</li>
<li role="presentation">
  <div class="row chapter-row">
    <div class="col-xs-12" role="treeitem">
      <i class="lyndacon caret-grey chapter-caret ga" data-ga-action="click" data-ga-label="toc-chapter-caret" data-ga-value="388293"></i>
      <h4 class="ga" data-ga-action="click" data-ga-label="toc-chapter" data-ga-value="388293">2. 3ds Max Interface</h4>
    </div>
  </div>
  <ul class="row toc-items container-fade-bottom">
    <li data-video-id="388294" class="toc-video-item" role="presentation" data-item-id="388294" data-item-type="video">
      <div class="row video-row">
        <div class="col-xs-11 video-name-cont">
          <i class="ga lyndacon booker bookmark-outline" data-bookmark-id=""></i>
          <a href="http://www.lynda.com/3ds-Max-tutorials/Getting-familiar-interface/373552/388294-4.html" class="item-name video-name ga" role="listitem" data-ga-action="click" data-ga-label="toc-video" data-ga-value="388294">
                                        Getting familiar with the interface
                                    </a>
          <div>
            <span class="video-duration">3m 41s</span>
          </div>
        </div>
        <div class="col-xs-1 video-actions-cont">
          <i class="ga watch-trigger popover-trigger lyndacon" data-videoid="388294" data-ga-action="click" data-ga-label="toc-video-eye" data-ga-value="388294"></i>
        </div>
      </div>
    </li>
    <li data-video-id="388295" class="toc-video-item" role="presentation" data-item-id="388295" data-item-type="video">
      <div class="row video-row">
        <div class="col-xs-11 video-name-cont">
          <i class="ga lyndacon booker bookmark-outline" data-bookmark-id=""></i>
          <a href="http://www.lynda.com/3ds-Max-tutorials/Using-Create-Modify-panels/373552/388295-4.html" class="item-name video-name ga" role="listitem" data-ga-action="click" data-ga-label="toc-video" data-ga-value="388295">
                                        Using the Create and Modify panels
                                    </a>
          <div>
            <span class="video-duration">3m 36s</span>
          </div>
        </div>
        <div class="col-xs-1 video-actions-cont">
          <i class="ga watch-trigger popover-trigger lyndacon" data-videoid="388295" data-ga-action="click" data-ga-label="toc-video-eye" data-ga-value="388295"></i>
        </div>
      </div>
    </li>

希望有人可以帮助创建一个程序来从html中提取信息,以按逻辑顺序排列文件。

0 个答案:

没有答案