1

I found a w3m plugin in w3m-extension.el for English-Chinese dict like this:

(defun w3m-search-dict-cn ()
   "Translate input word and search from dict.cn."
   (interactive)
   (w3m-search-advance "http://dict.cn/search/?q=" "English Dict.cn" 'gbk))

I configue the w3m plugin to search the dict online using the youdao dict website.

(defun w3m-search-dict-cn ()
    "Translate input word and search from youdao.cn."
    (interactive)
    (w3m-search-advance "http://dict.youdao.com/search?q=" "English youdao.cn" 'UTF-8))

But I found that the result info is too large to read .

What i want is just

<div id="collinsResult" class="tab-content">
 <div class="trans-container">
     <div class="trans-content">
         <div class="collinsToggle trans-container">
             <div class="wt-container">
                 <h4>
                     <span class="title">exception</span>
                     <em class="additional spell phonetic">/ɪkˈsɛpʃən/</em>
                     <span class="star star3" title="使用频率"></span>
                     <span class="via rank">CET4 TEM4</span>


                     <span class="additional pattern">(
                         exceptions
                         )</span>

                 </h4>

                 <ul class="ol">

                     <li>
                         <div class="collinsMajorTrans">
                             <span class="collinsOrder">1.&nbsp;</span>
                             <p>
                                 <span class="additional" title="可数名词">N-COUNT</span>
                                 An <b>exception</b> is a particular thing, person, or situation that is not included in a general statement, judgment, or rule. 例外

                             </p></div>
                         <div class="exampleLists">
                             <span class="collinsOrder">例:</span>
                             <div class="examples">
                                 <p> Few guitarists can sing as well as they can play; Eddie, however, is an exception. </p>
                                 <p>很少有吉他手唱歌能唱得跟弹得一样好,而艾迪是个例外。</p>
                             </div>
                         </div>
                         <div class="exampleLists">
                             <span class="collinsOrder">例:</span>
                             <div class="examples">
                                 <p> The law makes no exceptions. </p>
                                 <p>法律不搞例外。</p>
                             </div>
                         </div>
                     </li>

                     <li>
                         <div class="collinsMajorTrans">
                             <span class="collinsOrder">2.&nbsp;</span>
                             <p>
                                 <span class="additional" title="习语">PHRASE</span>
                                 If you make a general statement, and then say that something or someone is <b>no exception</b>, you are emphasizing that they are included in that statement. 不例外; 无例外

                                 <span class="additional">[强调]</span>
                             </p></div>
                         <div class="exampleLists">
                             <span class="collinsOrder">例:</span>
                             <div class="examples">
                                 <p> Marketing is applied to everything these days, and books are no exception. </p>
                                 <p>现在市场营销用于任何事物,图书也不例外。</p>
                             </div>
                         </div>
                     </li>

                     <li>
                         <div class="collinsMajorTrans">
                             <span class="collinsOrder">3.&nbsp;</span>
                             <p>
                                 <span class="additional" title="习语">PHRASE</span>
                                 If you <b>take exception to</b> something, you feel offended or annoyed by it, usually with the result that you complain about it. 厌恶; 反感

                             </p></div>
                         <div class="exampleLists">
                             <span class="collinsOrder">例:</span>
                             <div class="examples">
                                 <p> He also took exception to having been spied on. </p>
                                 <p>他也厌恶被暗中监视。</p>
                             </div>
                         </div>
                     </li>

                     <li>
                         <div class="collinsMajorTrans">
                             <span class="collinsOrder">4.&nbsp;</span>
                             <p>
                                 <span class="additional" title="习语">PHRASE</span>
                                 You use <b>with the exception of</b> to introduce a thing or person that is not included in a general statement that you are making. 除外

                             </p></div>
                         <div class="exampleLists">
                             <span class="collinsOrder">例:</span>
                             <div class="examples">
                                 <p> Yesterday was a day off for everybody, with the exception of Lorenzo. </p>
                                 <p>昨天每个人休一天假,洛伦佐除外。</p>
                             </div>
                         </div>
                     </li>
             </div>
         </div>
     </div>
 </div>
</div>

when i search the word "exception" not the whole page.

How can I use the w3m to download the page and get what i want part of the html and then display in the emacs buffer?

savior
  • 652
  • 5
  • 12

1 Answers1

2

M-x w3m-view-source, display source code

M-x html-mode, or any other mode providing the convenient key-binding

Mark the part of interest

M-x copy-to-buffer MY_NEW_BUFFER

Add <html>``</html> tags if missing in section

M-x w3m-buffer, display selected content

Andreas Röhler
  • 4,546
  • 11
  • 17