[Python] Romella liwebosaeteng ho tsoa ho Telegraph.

Bakeng sa taba e bonolo ea ho boloka nako ha u phatlalatsa ho li-social network, theha lenaneo le lenyane ho python ka thuso ea Bots de thelekramo. Lenaneo le sebetsa ka tsela e latelang: "Molaetsa"> Bot ho Python (Telegram Py API> Facebook Py API)> "Facebook"> "Twitter". Lenaneo ke Mohloli o Hlahileng mme e sebetsa hantle ho Linux, Windows, mme mohlomong OS X (ke nahana).

Kopo

U tlameha feela ho kopanya pokello ea GitHub:

git clone https://github.com/XTickXIvanX/Telegram2FB.git

Re kenya litlhoko:

pip install DictObject requests facebook-sdk

Re theha file ea Bot mme re fumana token:

https://core.telegram.org/bots

Re theha e ncha app e de Facebook:

https://developers.facebook.com/apps/

Hang ha re bōpiloe re fumana ea rona token ea ho fihlela le:

https://developers.facebook.com/tools/explorer/

Re fana ka litumello tse latelang ha re e hlahisa:

Screenshot (79)

Screenshot (80)

Re fetola faele ea Run.py ea lenaneo mme re nkele lintlha tse tharo tsa API_KEY = »…» »polygonal le file token de thelekramo le lintlha tse tharo tsa graph graph = facebook.GraphAPI (access_token = '…') ea token ho tsoa Facebook.

Re hokahanya ak'haonte ea rona le Twitter a Facebook ho tweet seo re se ngolang Facebook.

Re tsamaisa lenaneo:
python Run.py

E phethiloe!

Hona joale e sala feela ho bula thelekramo 'me u romelle molaetsa ho rona Bot: '/ phatlalatsa «Kenya mona seo u batlang ho se phatlalatsa»'.


Litaba tsa sengoloa sena li latela melao-motheo ea rona ea melao ea boitšoaro ea bongoli. Ho tlaleha phoso tlanya mona.

Maikutlo a 10, siea ea hau

Siea maikutlo a hau

aterese ya hao ya imeile ke ke ho phatlalatswa.

*

*

  1. E ikarabella bakeng sa data: Miguel Ángel Gatón
  2. Morero oa data: Laola SPAM, tsamaiso ea maikutlo.
  3. Molao: Tumello ea hau
  4. Puisano ea data: Lintlha li ke ke tsa tsebisoa batho ba boraro ntle le ka tlamo ea molao.
  5. Polokelo ea data: Database e hapiloeng ke Occentus Networks (EU)
  6. Litokelo: Nako efe kapa efe o ka fokotsa, oa hlaphoheloa mme oa hlakola tlhaiso-leseling ea hau.

  1.   ela a re

    Damn cool .. Ke ne ke mpa ke batla mokhoa oa ho beha marang-rang a ka kaofela ka nako e le ngoe 😀

    1.    Ivan Molina Rebolledo a re

      Ho bohlokoa ho nna ho boloka chelete e nyane ha ke tsoa ka tlung mme ha ho na netweke ea W e bulehileng ea D:

  2.   K a re

    Lumela, monehelo o motle, empa ha ke leka ho MAcOS, ka python 2.7.6, ke na le phoso ena:

    /Library/Python/2.7/site-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarn: Ntho ea 'nete ea SSLContext ha e fumanehe. Sena se thibela urllib3 ho hlophisa SSL ka nepo mme e ka baka likhokahano tse itseng tsa SSL ho hloleha. Bakeng sa tlhaiso-leseling e batsi, bona https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

    1.    K a re

      Ke se ke e rarolotse, ho ne ho se na mekhoa ea ho kenya e neng e le teng.

      1.    Ivan Molina Rebolledo a re

        E phethahetse! Haeba o na le bothata bo bong o ka tlaleha ho bona https://github.com/XTickXIvanX/Telegram2FB/issues 😉

  3.   Matthias a re

    U khona joang ho laola hore batho bohle ba se ke ba sebelisa bot ea hau?

    1.    Ivan Molina Rebolledo a re

      Bonolo. Moleng oa 38 u ka fetola "/ phatlalatsa" ka "/ loquequierasperoqueotronosepa", moleng oa 40 u fetola ("/ phatlalatsa", "") ka ("/ loquequierasperoqueotronosepa", "") (Sebaka sea hlokahala).
      Kahoo ha ho motho ea ka e sebelisang haese uena.

  4.   Yasmany a re

    Lumeliso ke latetse mehato eohle mme ha u sebelisa script e koala hang-hang, ona ke phoso:

    Boitsebiso ba bot: {u'ok ': Ke' nete, u'result ': {u'username': u'yacopy_bot ', u'first_name': u'telegram2fb ', u'id': my_id}}
    {u'message ': {u'date': 1439307530, u'text ': u' / post "Hello" ', u'from': {u'first_name ': first name, u'last_name': fane, u 'Yo hice}
    Traceback (mohala oa morao-rao o qetetse):
    Faela "Run.py", mohala oa 43, ho
    graph.put_wall_post (molaetsa = pong1)
    Faele "/usr/local/lib/python2.7/dist-packages/facebook.py", mohala oa 159, ho put_wall_post
    ** sehokelo)
    Faele "/usr/local/lib/python2.7/dist-packages/facebook.py", mohala 140, ho put_object
    post_args = data)
    Faele "/usr/local/lib/python2.7/dist-packages/facebook.py", mohala 297, ha o kopa
    karabelo = _parse_json (e.read ())
    Faele "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", moleng oa 488, ka bongata
    khutla _default_decoder.decode (s)
    Faele "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", mohala 370, ha u khetholla
    sepheo, end = self.raw_decode (s)
    Faele "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", mohala 389, ho raw_decode
    khutla self.scan_once (s, idx = _w (s, idx) .end ())
    simplejson.scanner.JSONDecodeError: Boleng ba tebello: mohala 1 kholomo 1 (char 0)

  5.   Jame a re

    Khabane ka ho fetisisa…

    Ke hloka bot ho e romella ho tsoa ho Telegraph ho Twitter

  6.   Cesar P. Moreno a re

    Sena se ka ntumella ho beha ho facebook, linkedin le liwebosaete tse ling tsa sechaba? kapa ha ke tsebe hore na e etsetsoa eng ...
    Linux e ile ea e tseba hantle.

bool('nete)