Cov txheej txheem:

Kev Txawj Ntse Alexa: Nyeem Qhov Tseeb Tseeb Tseeb (Hauv Qhov No, Vajtswv): 6 Kauj Ruam
Kev Txawj Ntse Alexa: Nyeem Qhov Tseeb Tseeb Tseeb (Hauv Qhov No, Vajtswv): 6 Kauj Ruam

Video: Kev Txawj Ntse Alexa: Nyeem Qhov Tseeb Tseeb Tseeb (Hauv Qhov No, Vajtswv): 6 Kauj Ruam

Video: Kev Txawj Ntse Alexa: Nyeem Qhov Tseeb Tseeb Tseeb (Hauv Qhov No, Vajtswv): 6 Kauj Ruam
Video: Xyw By Nquab Tsab New Song 2022-2023 2024, Hlis ntuj nqeg
Anonim
Alexa Skill: Nyeem Qhov Tseeb Tseeb (Hauv Qhov No, Vajtswv)
Alexa Skill: Nyeem Qhov Tseeb Tseeb (Hauv Qhov No, Vajtswv)

Kuv tau ua Alexa Skill los nyeem "Vajtswv Tseeb Tweet" - cov ntsiab lus, uas yog, los ntawm @TweetOfGod, 5 lab+ tus lej sau npe tus account tsim los ntawm yav dhau los Txhua Hnub Qhia ua yeeb yam txawj sau ntawv. Nws siv IFTTT (Yog Tias Yog Li No), Google Spreadsheet, thiab tsis yooj yim-rau-siv Alexa Txawj Txawj Tsim, Zaj Dab Neeg.

Txhawm rau kom tau txais lub tswv yim ntawm qhov tshwm sim kawg, koj tuaj yeem ntxiv qhov txuj ci rau koj lub cuab yeej Alexa ntawm no, lossis koj tuaj yeem saib ua ntej qhov txuj ci ntawm Storyline yog tias koj tus lej Alexa tsis nyob hauv Asmeskas lossis koj tsis muaj Alexa ntaus ntawv.

Yog tias koj xav tsim Alexa txuj ci uas nyeem tweets, qhov no yog txoj hauv kev yooj yim los ua nws. Tsis muaj qhov coding koom nrog yog tias koj tsuas yog siv kuv tus qauv, tab sis yog tias koj xav mus hla txoj hauv kev nws pab paub me ntsis txog cov cai feem ntau thiab tshwj xeeb yog li cas JSON hu tau teeb tsa. Tab sis yog tias koj tsuas yog rov ua dua qhov txuj ci no rau lwm tus account Twitter, nws yuav tsis xav tau kev tshaj lij tshaj li txiav thiab muab tshuaj txhuam.

Koj yuav xav tau dab tsi:

  • Alexa Device (lossis tus as khauj nrog Echoism.io - zoo Alexa virtual simulator)
  • Ib tus account Alexa Developer
  • Ib tus account google los tsim daim ntawv nthuav qhia nrog
  • Ib tus account nrog Storyline
  • Ib tus as khauj nrog Yog Qhov No Yog Li No (IFTTT)
  • Ib tus lej tso nyiaj lossis qhov chaw uas koj tuaj yeem tuav mp3 cov ntaub ntawv ntawm tus neeg rau zaub mov ruaj ntseg

Tag nrho cov nyiaj no yog pub dawb.

Kuv yuav tsis nkag mus rau ntau yam hais txog qhov pib ntawm yuav ua li cas thiaj tsim tau Storyline txuj ci - muaj cov lus qhia zoo heev ntawm qhov chaw kawm paub yuav tsim cov block, txuas lawv, thiab ceg ntawm cov xwm txheej. Phau ntawv qhia no yuav tsom mus rau peb yam uas kuv tau kawm tsim lub peev xwm no: tau txais lub suab MP3 zoo rau hauv koj qhov txuj ci, txuas cov ntsiab lus twitter ntawm IFTTT thiab Google Ntawv, thiab yuav ua li cas los tsim qhov tweet tsis raug los ntawm cov txheej txheem tsim ua ntej.

(Thiab qw nrov rau Alexa Skill Developer George Collier, nws qhov kev qhia tau zoo ntawm kev tau txais twitter ua ke rau hauv Alexa tau txais kuv pib.)

Kauj Ruam 1: Kauj Ruam 1: Xav Txog Qhov Ncauj Ntawm Koj Li Kev Txawj Ntse

Kauj Ruam 1: Xav Txog Qhov Tseeb Tag Nrho Ntawm Koj Txoj Kev Txawj Ntse
Kauj Ruam 1: Xav Txog Qhov Tseeb Tag Nrho Ntawm Koj Txoj Kev Txawj Ntse

Zaj dab neeg yog ib txoj hauv kev zoo los tsim Alexa kev txawj nrog me lossis tsis muaj coding. Koj tuaj yeem rub-thiab-nco cov block rau hauv qhov chaw thiab teeb tsa kev sib txuas thiab txoj hauv kev ntawm kev nqis tes ua los ntawm qhov yooj yim-rau-nkag siab cov duab nraaj. Yog tias koj tau siv Yahoo Pipes, koj yuav paub txog lub interface.

Tam sim no, ib qho ntawm qhov zoo ntawm Storyline yog tias nws ua kom yooj yim kom tau txais Alexa los hais lus qhov txiaj ntsig ntawm ib qho lus nug JSON. Tau txais cov ntaub ntawv tawm ntawm Google Cov Ntawv Tshaj Tawm tau yooj yim nrog JSON cov lus nug. Tau txais tweets INTO a google spreadsheet nrog Yog Qhov No Tshaj Yog qhov yooj yim. Yooj yim. Yooj yim. Yooj yim.

Kuv pom tias nws zoo tshaj los tsuas yog pom koj qhov txuj ci tag nrho hauv kev paub daws teeb ua ntej koj pib.

Thaum kuv xav txog kuv qhov txuj ci, Kuv paub tias nws lub hom phiaj tseem ceeb tsuas yog xa tawm qhov tseeb tweet. Tab sis kuv tuaj yeem txhim kho qhov ntawd nrog lub suab me me tsim (Zaj dab neeg tso cai rau koj lub peev xwm los ua si txhua yam MP3), thiab ib qho tweet yuav tsis txaus los muab cov neeg saj ntawm tus lej - Kuv tuaj yeem khaws qee cov tweets qub thiab cia tus neeg siv hnov ib ntawm cov tom qab qhov tseeb. Yog li kuv qhov txuj ci ntws tawm yuav zoo li no:

  1. Zoo siab txais tos tus neeg siv nrog me ntsis ntawm cov lus hais thiab lub suab pib tsim nyog
  2. Nyeem qhov tseeb tweet
  3. Ua lub suab kos npe
  4. Nug tus neeg siv yog tias lawv xav hnov lub suab laus dua tweet

    1. Yog? Nyeem ib tus laus dua tweet.
    2. Ua lub suab kos npe
    3. Tsis yog? Tawm qhov txuj ci.

Lub hauv paus ntawm "Qhov Tseeb Tshaj Tawm" yog google daim ntawv nthuav tawm, pub los ntawm Qhov Yog Yog Li No Cov Ntawv ntawd. Txoj kev ntawd zoo li qhov no:

  1. Yog tias muaj qhov tweet tshiab los ntawm @TweetOfGod tus lej, nws tau theej rau hauv daim ntawv nthuav tawm
  2. Yog tias tweet muaj qhov txuas lossis duab, daim ntawv nthuav tawm nws tawm
  3. Yog tias tweet yog retweet, daim ntawv nthuav dav lim nws tawm
  4. Tweets uas tau txais los ntawm ob lub lim ntawv no tau ua tiav rau kev nyeem: # hloov pauv nrog lo lus "Hashtag" thiab ntau lwm cov cim tau hloov nrog cov ntawv nyeem tau zoo sib xws
  5. Qhov kawg tweet tau theej rau hauv "xov xwm tshiab tshaj tawm" ntawm tes uas Alex nyeem

Kauj Ruam 2: Kauj Ruam 2: Tsim Kev Txais Tos Zoo Nrog Cov Lus Taw Qhia

Kauj Ruam 2: Tsim Qhov Zoo Tshaj Plaws Txais Tos Nrog Cov Lus Taw Qhia
Kauj Ruam 2: Tsim Qhov Zoo Tshaj Plaws Txais Tos Nrog Cov Lus Taw Qhia
Kauj Ruam 2: Tsim Qhov Zoo Tshaj Plaws Txais Tos Nrog Cov Lus Taw Qhia
Kauj Ruam 2: Tsim Qhov Zoo Tshaj Plaws Txais Tos Nrog Cov Lus Taw Qhia
Kauj Ruam 2: Tsim Qhov Zoo Tshaj Plaws Txais Tos Nrog Cov Lus Taw Qhia
Kauj Ruam 2: Tsim Qhov Zoo Tshaj Plaws Txais Tos Nrog Cov Lus Taw Qhia

Ua ntej Alexa nyeem qhov tweet tam sim no, kuv tau tsim ib ntawm plaub qhov kev lom zem saum ntuj ceeb tsheej. Cov no yog MP3s uas tau ua tiav rau Alexa los ntawm zaj dab neeg. Kuv pom kuv cov MP3s ntawm Freesound (Thiab txhua yam muaj tiag tiag dawb, tab sis ua neeg ncaj ncees thiab tawm lus qhia).

  1. Download tau koj MP3. Nws yuav tsum tsawg dua 90 Seconds. Alexa tshwj xeeb txog hom ntawv. Yog tias koj paub nws yog MPEG Version 2 thiab 48kps koj tuaj yeem hla cov kauj ruam tom ntej. Tab sis yog tias koj tsis paub lossis nws yog ib yam txawv, nws yooj yim los hloov.
  2. Rub nws mus rau Storyline rau kev ua ntawm lawv Cov Suab Hloov
  3. Host koj lub suab rub tawm ntawm HTTPS server

Yog tias theem 3 koj puas tau mus "Ua Dab Tsi Tam Sim No?" tej zaum koj tsis muaj kev nkag mus rau https server uas koj tuaj yeem tuav koj cov ntaub ntawv ntawm. Tsis txhob txhawj, koj tuaj yeem ua qhov ntawd nrog dropbox. Koj yuav xav tau tus as khauj, tab sis ntxiv, ib qho dawb yog qhov zoo. Nov yog cov kauj ruam:

  1. Mus rau https://www.dropbox.com/h thiab nkag mus rau hauv koj tus as khauj.
  2. Nyem Upload cov ntaub ntawv khawm
  3. Xaiv cov ntawv mp3 uas koj tau hloov dua siab tshiab.
  4. Nyem Qhia
  5. Nyem Tsim qhov txuas thiab Luam qhov txuas
  6. Hauv qhov txuas koj tau theej, hloov "dropbox" nrog "dl.dropboxusercontent" yam tsis muaj nqe lus
  7. Luam qhov URL ntawd

Tam sim no koj yuav mus rau hauv qab ntawm koj qhov kev tos txais tos thiab nyem rau lub cim suab paj nruag cim.

Muab tshuaj txhuam koj qhov URL rau hauv. Yog tias koj xav ntxiv qhov hloov pauv tsis raug, rov ua cov txheej txheem rau ob peb MP3 ntxiv thiab nyem rau ntawm Hamburger cov ntawv qhia hauv qab URL muab tshuaj txhuam lub thawv.

Kauj Ruam 3: Kauj Ruam 3: Teeb IFTTT

Kauj Ruam 3: Teeb IFTTT
Kauj Ruam 3: Teeb IFTTT
  1. Mus rau koj tus lej IFTTT thiab xaiv "Tsim cov applet tshiab"
  2. Xaiv TWITTER ua IF Service.
  3. Xaiv "Tweet tshiab los ntawm cov neeg siv tshwj xeeb ua tus Trigger. Sau lub npe ntawm tus as khauj uas koj xav ua raws
  4. Xaiv "Google Ntawv" raws li THEN cov kev pabcuam
  5. Xaiv "Ntxiv Kab rau Spreadsheet"
  6. Hauv qhov "Formatted Row" Field, tshem txhua yam tsuas yog {{TEXT}} teb.
  7. Tsim koj cov txuj ci.

Qhov no tsim daim ntawv nthuav tawm tshiab thiab ntxiv kab txhua lub sijhawm tweet tshiab tawm mus. Koj yuav nyiam siv ib lub xov tooj ntawm koj daim ntawv nthuav qhia thiab yooj yim dua sau nws cov ntsiab lus txhua lub sijhawm. Hauv qhov xwm txheej ntawd, hauv qib 5 koj tuaj yeem xaiv qhov kev xaiv los sau rau hauv ib lub cell xwb. Kuv nyiam khaws cov ntaub ntawv ntawm tweets, raws li kuv ib ntus txav cov uas tsis yog tshuaj pleev lossis cuam tshuam rau cov xov xwm mus rau "Laus Tweets" spreadsheet. Nco ntsoov tias yog koj xaiv qhov kev xaiv no, koj yuav tsum tau ua qee qhov kev saib xyuas ntawm koj daim ntawv: ib qho tshiab yuav raug tsim tom qab 2000 kab.

Kauj Ruam 4: Kauj Ruam 4: Teeb Koj Daim Ntawv Google

Kauj ruam 4: Teeb Koj Daim Ntawv Google
Kauj ruam 4: Teeb Koj Daim Ntawv Google
Kauj ruam 4: Teeb Koj Daim Ntawv Google
Kauj ruam 4: Teeb Koj Daim Ntawv Google
Kauj ruam 4: Teeb Koj Daim Ntawv Google
Kauj ruam 4: Teeb Koj Daim Ntawv Google

Daim Ntawv Qhia Google no yog lub plawv ntawm cov txuj ci tshwj xeeb no, vim tias nws lim tawm tweets uas tsis ua haujlwm zoo nrog Alexa (tweets uas xa mus rau cov duab, piv txwv li, lossis tweets nrog txuas) thiab nws ua cov ntawv-tsuas yog tweets ntau dua Alexa -phooj ywg nrog ob peb yam hloov pauv yooj yim.

Cia IFTT tsim koj daim ntawv teev npe nrog ob peb nkag - yog li tsuas yog tos ob peb tweets los ntawm tus as khauj koj taug qab mus rau qhov ntawd, qhib Google Cov Ntawv, thiab txheeb raws lub sijhawm tsim. Koj yuav pom koj daim ntawv tshiab ci ci sab xis saum toj. Tam sim no, txhua qhov tweet tshiab yuav nyob rau hauv kab tshiab, yog li peb xav tsim cov qauv uas yuav lim tawm cov tweets uas muaj cov txuas lossis cov duab thiab hla mus nrhiav qhov kawg hauv kab ntawv.

Koj tuaj yeem rov ua daim ntawv theej ntawm kuv daim ntawv no lossis koj tuaj yeem tsim koj tus kheej nrog cov hauv qab no:

  1. Hloov npe tab nrog tweets hauv nws "Nyob ntawm IFTTT"
  2. Ntxiv Tab uas hu ua "Processing Tweets" rau daim ntawv nthuav qhia
  3. Ntxiv cov mis no rau hauv cell A8 ntawm Kev Ua Tweets tab:

= QUERY ('Nyob ntawm IFTTT'! A3: A2000, "Xaiv Ib Qhov Tsis Muaj A muaj 'https'")

Qhov ntawd rub tawm txhua qhov tweets uas tsis muaj qhov txuas rau hauv Kab A ntawm koj tab ua.

Tam sim no peb yuav tsum nrhiav qhov kawg tweet hauv kab ntawv ntawd. Muab tshuaj txhuam cov mis hauv qab no rau hauv cell B7 ntawm kev ua tab:

= INDEX (FILTER (A: A, NOT (ISBLANK (A: A))), ROWS (FILTER (A: A, NOT (ISBLANK (A: A))))))

Tam sim no peb xav ua qee qhov kev hloov pauv kom ua rau tweet yooj yim rau Alexa nyeem. Cov no tuaj yeem ua tau txhua yam hauv ib tus lej nkaus xwb, tab sis kuv tsoo lawv kom pom meej:

Hauv Cell B6 muab tshuaj txhuam ntawm Cov Txheej Txheem tab:

= trim (regexreplace (B7, "#", "Hashtag"))

Uas saib cov ntsiab lus ntawm tes hauv qab no thiab hloov qhov # kos npe nrog lo lus "Hashtag"

Hauv Cell B5 muab tshuaj txhuam tom ntej:

= trim (regexreplace (B6, "@", "ntawm"))

Koj tau txais lub tswv yim.

Hauv Cell B4 muab tshuaj txhuam:

= trim (regexreplace (B6, "&", "thiab"))

Hauv Cell B3:

= trim (regexreplace (B6, "%", "feem pua"))

Hauv Cell B2 peb yuav tso tus lej me ntsis nyuab dua:

= ArrayFormula (REGEXREPLACE (B3, "([^A-Za-z0-9.,!?:; ''])", ""))

Qhov no tsuas yog tshem tawm txhua yam uas tsis yog tus lej, ntawv, lossis ib qho ntawm cov cim cim cim uas Alexa nkag siab.

Hauv Cell B1 peb tsuas yog yuav theej tawm qhov kawg tweet:

= qhov ntsuas (B2)

Qhov ntawd yog cov ntawv kawg thiab koj tuaj yeem tsim cov phiaj xwm dab tsi los tuav lub xov tooj ntawd yog tias koj paub me ntsis ntawm JSON, tab sis kom ua qee yam yooj yim me ntsis ntawm zaj dab neeg xaus, Kuv nyiam luam cov ntsiab lus rau hauv "Live from IFTTT" tab los ntawm kev tso qhov no mis hauv A2 hauv "Nyob ntawm IFTTT" tab:

= 'Ua Qhov Chaw'! B1

Groovy. Tam sim no koj daim ntawv teev npe tau teeb tsa thiab npaj tau nyeem los ntawm Storyline JSON cov lus nug.

Kauj Ruam 5: Kauj Ruam 5: Teeb Koj Li "Tweet Tseeb" JSON Cov Lus Nug hauv Zaj Dab Neeg

Kauj ruam 5: Teeb Koj Li
Kauj ruam 5: Teeb Koj Li
Kauj Ruam 5: Teeb Koj Li
Kauj Ruam 5: Teeb Koj Li
Kauj ruam 5: Teeb Koj Li
Kauj ruam 5: Teeb Koj Li
  1. Mus rau koj cov txuj ci zaj dab neeg qhov zoo siab tos txais thiab ntxiv ntu "Dab Tsi Alexa Hais".
  2. Ntxiv cov kab lus pib zoo li "Nov yog qhov tseeb tweet los ntawm TheTweetOfGod:"
  3. Siv Hamburger Menu los ntxiv kev hloov pauv
  4. Nyem rau ntawm sab xub xub xub thiab xaiv "Tsim Tshiab Thaiv"

Kuv hu kuv qhov thaiv tshiab "Tau txais Vajtswv Tweet" Txoj haujlwm ntawm no yog mus nqa qhov tseeb, lim tawm tweet los ntawm daim ntawv nthuav dav ntawm tes A2 ntawm thawj lub tab. Koj ua qhov ntawd los ntawm kev nqa cov ntaub ntawv nrog JSON thov xa los ntawm Google Sheets API: Nws tsis muaj dab tsi ntau dua li qhov zoo nkauj URL.

  1. Nyem rau lub cim me me nyob sab xis ntawm koj qhov thaiv tshiab txhawm rau ntxiv JSON thov.
  2. Npe koj qhov kev thov API. Kuv hu kuv li "GetGodTweet"
  3. Nrhiav qhov URL ntawm koj daim ntawv nthuav qhia los ntawm kev ua qhov no:

    1. Nyem rau ntawm File -> Publish To Web hauv koj daim ntawv nthuav qhia.
    2. Siv lub txiaj ntsig qub thiab tsuas yog nyem "Tshaj tawm"
    3. Luam qhov URL thiab muab tshuaj txhuam rau hauv cov ntawv ceeb toom.

Kuv piv txwv yog:

"https://docs.google.com/spreadsheets/d/e/2PACX-1vSUnz43PEORZbBES1lQ8ZlJjH_4voh4Guc6SWrfjeGk2bZlY5EBYzLD5-fT633ygo_35Jz97cuUwKuy/pubhtml" Nws yog qhov me me ntawm /d /e thiab tom ntej /charcter. Yog li hauv qhov no:

2PACX-1vSUnz43PEORZbBES1lQ8ZlJjH_4voh4Guc6SWrfjeGk2bZlY5EBYzLD5-fT633ygo_35Jz97cuUwKuy

Koj pauv tus lej ntawd ntev me ntsis hauv cov url hauv qab no uas hais tias "SPREASHEET_ID":

"https://spreadsheets.google.com/feeds/list/SPREADSHEET_ID/od6/public/basic?alt=json"

  1. Tam sim no siv qhov url, thiab muab nws tso rau hauv lub thawv URL ntawm JSON Cov Lus Nug hauv Zaj Dab Neeg.
  2. Xaiv qhov kev xaiv "GET"
  3. Cia lub "Headers" Box tsis muaj dab tsi
  4. Hauv lub npov tom ntej, koj yuav tsim qhov sib txawv nrog cov ntsiab lus ntawm Cell A2 ntawm koj thawj lub tab los ntawm kev muab cov mis no tso rau hauv:

tweet = api_response.feed.entry.0.title. $ t

Qhov sib txawv yog lub npe "tweet". Nws tau theej cov ntsiab lus los ntawm thawj lub tab 0.

Tam sim no yog tias koj ntxiv "Alexa Hais" thaiv hauv qab koj cov lus nug JSON, thiab tsuas yog sau lo lus {{tweet}} hauv cov kab nkhaus, Alexa yuav hais cov ntsiab lus ntawm tes. Nco ntsoov tias rooj plaub sib xws nrog qhov sib txawv uas koj tau teev tseg hauv qib 4 !!!

Nias lub PLAY khawm ntawm Storyline thiab sim koj qhov kev txawj! Yog tias koj tau txais lo lus "Null" nws txhais tau tias qee yam tsis raug nrog koj li kev thov API.

Qhov ntawd yog nws tiag rau cov txuj ci yooj yim. Kuv ntxiv qhov kos npe me me tso dag nrog lwm MP3, thiab nug yog tias tus neeg siv xav hnov lub suab laus dua. Cov kauj ruam tom ntej qhia koj cov lus dag zoo rau kev tsim cov ntawv laus dua qub, tab sis nws yog te rau cov neeg uas xav coj lawv cov txuj ci qee qhov siv tau ntxiv.

Kauj Ruam 6: Yeem Ntxiv: Tsim Qhov Tsis Txaus Los Ntawm Google Cov Ntawv rau Alexa Nyeem

Yeem Ntxiv: Tsim Qhov Tsis Txaus Los Ntawm Google Cov Ntawv rau Alexa Nyeem
Yeem Ntxiv: Tsim Qhov Tsis Txaus Los Ntawm Google Cov Ntawv rau Alexa Nyeem

Yog tias koj xav kom tsim ib qho ntawm cov txheej ntawm cov laus tweets, ntawm no yog qhov ua kom yuam kev.

Kuv tsim daim ntawv thib peb hauv kuv daim ntawv hu ua "Older Tweets." Tag nrho cov no nyob hauv cov hlwb A1-A36 hauv kuv daim ntawv nthuav qhia

  1. Hauv Zaj Dab Neeg, tsim qhov thaiv tshiab hu ua "Oldertweets"
  2. Ntxiv JSON Cov Lus Nug kauj ruam
  3. Muab nws lub npe
  4. Hauv kab URL, siv tib API URL koj tsim nrog koj li Spreadsheet ID hauv Kawg Tweet kauj ruam, nrog ib qho kev hloov pauv:

    Hloov qhov me ntsis mus rau qhov kawg uas hais tias/od6/yooj yim/pej xeem rau/3/pib/pej xeem - qhov no hu TAB 3 hloov Tab 1

  5. Xaiv "GET"
  6. Tawm Headers dawb paug
  7. Hauv lub npov tom ntej, muab qhov no tso rau:

oldtweet = api_response.feed.entry.random.title. $ t

Koj tau tsim qhov hloov pauv tshiab, hu ua "oldtweet" thiab lo lus me "random" txhais tau tias qhov sib txawv yuav hloov pauv txhua lub sijhawm nug JSON.

Ntxiv lwm qhov "Alexa Hais" kauj ruam thiab ntxig koj qhov hloov pauv tshiab, {{oldtweet}} nrog cov nkhaus nkhaus. Boom! Random zoo!

Yog tias koj nyiam qhov Qhia Ntawv no, thov muab kuv qhov txuj ci ob peb hnub qub lossis tshuaj xyuas!

Pom zoo: