2016-11-09 2 views
0

나는이 링크에서 일부 데이터를 가져하려고 해요 : https://myanimelist.net/anime/seasonJSoup 추출 클래스 제목

내가 구체적으로 무엇을 찾고 있어요 모든 링크 이미지 텍스트입니다. 이 섹션의 IE :

<div class="seasonal-anime js-seasonal-anime" 
data-genre="7,42,37"><div> 
<div class="title"><a href="https://myanimelist.net/anime/32867/Bungou_Stray_Dogs_2nd_Season/video" class="icon-watch-pv fl-r" title="Watch Promotional Video">Watch Promotional Video</a><p class="title-text"> 
    <a href="https://myanimelist.net/anime/32867/Bungou_Stray_Dogs_2nd_Season" class="link-title">Bungou Stray Dogs 2nd Season</a> 
    </p> 
</div> 

<div class="prodsrc"> 
    <span class="producer"><a href="/anime/producer/4/Bones" title="Bones">Bones</a></span> 
    <div class="eps"> 
    <span id="32867" data-eps="12" class="fl-l icon-add-episode js-btn-add-episode" title="Click to increase your watched ep number by one"></span>  <a href="https://myanimelist.net/anime/32867/Bungou_Stray_Dogs_2nd_Season/episode"><span class="js-episode-num">6</span>/<span>12 eps</span> 
    </a> 
    </div> 

    <span class="source">Manga</span> 

    <a href="https://myanimelist.net/ownlist/anime/32867/edit?hideLayout=1" title="Watching" class="Lightbox_AddEdit button_edit btn-anime-watch-status js-anime-watch-status watching">CW</a> 
</div> 

    <div class="genres js-genre" id="32867"> 
     <div class="genres-inner js-genre-inner"><span class="genre"> 
     <a href="/anime/genre/7/Mystery" title="Mystery">Mystery</a> 
     </span><span class="genre"> 
     <a href="/anime/genre/42/Seinen" title="Seinen">Seinen</a> 
     </span><span class="genre"> 
     <a href="/anime/genre/37/Supernatural" title="Supernatural">Supernatural</a> 
     </span></div> 
    </div> 
    </div> 

     <div class="image lazyload" data-bg="https://myanimelist.cdn-dena.com/images/anime/4/82293.webp"> 
     <a href="https://myanimelist.net/anime/32867/Bungou_Stray_Dogs_2nd_Season" class="link-image">Bungou Stray Dogs 2nd Season</a> 
     </div> 

     <div class="synopsis js-synopsis"> 
     <span class="preline">Nakajima Atsushi was kicked out of his orphanage, and now he has no place to go and no food. While he is standing by a river, on the brink of starvation, he rescues a man whimsically attempting suicide. That man is Dazai Osamu, and he and his partner Kunikida are members of a very special detective agency. They have supernatural powers and deal with cases that are too dangerous for the police or the military. They&#039;re tracking down a tiger that has appeared in the area recently, around the time Atsushi came to the area. The tiger seems to have a connection to Atsushi, and by the time the case is solved, it is clear that Atsushi&#039;s future will involve much more of Dazai and the rest of the detectives! 

    (Source: MangaHelpers)</span> 
     <p class="licensors" data-licensors=""></p> 
     </div> 

     <div class="information"> 
     <div class="info"> 
      TV - 
      <span class="remain-time"> 
         Oct 6, 2016, 22:30 (JST)    </span> 
     </div> 
     <div class="scormem"> 
      <span class="member fl-r" title="Members"> 
      72,011 
      </span> 
      <span class="score" title="Score"> 
      8.34 
      </span> 
     </div> 
     </div> 

    </div> 

Bungou Stray Dogs 2nd Season을 받고 싶습니다. 또한 data-bg 값 (https://myanimelist.cdn-dena.com/images/anime/4/82293.webp)을 얻고이 데이터의 모든 쌍에 대해 점수 (8.34)를 얻고 싶습니다.

저는 Jsoup에서 실행되는 쿼리가 HTML에 대해 아직 완전히 익숙하지 않아 실제로 이해하지 못합니다.

이 코드를 실행하면 나에게 아무것도하지 않습니다

Document doc = Jsoup.connect("https://myanimelist.net/anime/season").get(); 
Elements shows = doc.select("div:contains(image.lazyload)"); 

int i = 0; 
for(Element show : shows){ 
    System.out.println(i+". "+show.text()); 
    i++; 
} 
+0

@TerryLi 나는 그것을 끝내었지만 여전히 정확하게 무엇을 해야할지 잘 모르겠습니다. – user2923535

답변

1

당신은 단지 here을 설명 된대로 select 구문을 따라야합니다.

Elements imageLinks = doc.select("a.link-image"); 

다른 두가 비슷합니다 : 예를 들어

은 링크 이미지 텍스트를 얻을 수 있습니다. 너가 그걸 알아낼 수있을거야.