Giter Site home page Giter Site logo

Comments (2)

Truth1987 avatar Truth1987 commented on May 25, 2024

getRawData 就是給你原始資料阿@@

from pyptt.

eight04 avatar eight04 commented on May 25, 2024

我建議在資料還是 bytes 的時候就把 backspace 處理掉(退格,遇到一個 backspace 就刪除一個字元)。另外直接移除 backspace 的方法也不太正確,例如這篇文章︰
#1RA8YbnY (Test) [ptt.cc] [測試]
https://www.ptt.cc/bbs/Test/M.1529383077.A.C62.html

用以下的程式抓取文章內容︰

from pprint import pprint
from PTTLibrary import PTT

bot = PTT.Library(kickOtherLogin=False)
bot.login(USER, PASSWORD)
err, post = bot.getPost("test", "1RA8YbnY")
pprint((
	post.getBoard(),
	post.getID(),
	post.getAuthor(),
	post.getContent()
))
[06-19 12:38:08][資訊] 偵測到前景執行使用編碼: utf-8
[06-19 12:38:08][資訊] 使用者帳號:
[06-19 12:38:08][資訊] 密碼:
[06-19 12:38:08][資訊] 產生 SSH 金鑰完成
[06-19 12:38:08][資訊] 連線頻道 0 啟動
[06-19 12:38:24][資訊] 頻道 0 建立互動通道成功
[06-19 12:38:24][資訊] 頻道 0 輸入帳號
[06-19 12:38:24][資訊] 頻道 0 輸入密碼
[06-19 12:38:24][資訊] 頻道 0 讀取 PTT 畫面..
[06-19 12:38:24][資訊] 不刪除重複登入的連線
[06-19 12:38:29][資訊] 任意鍵繼續
[06-19 12:38:29][資訊] 頻道 0 登入成功
('test',
 '1RA8YbnY',
 'eight0 (人類)',
 '前半部  ♥後半部\n\n--\nヾ(;  ω;) ヾ(;  ω;)\n\nhttp://i.imgur.com/oAd97.
png\n\n--')

可以看到在「♥」之前多了兩個空格。

from pyptt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.