IT |
@IT 全フォーラム 最新記事一覧 |
GitHub、Markdownファイルに「Mermaid」で図を挿入可能に |
https://atmarkit.itmedia.co.jp/ait/articles/2204/12/news043.html
|
github |
2022-04-12 18:30:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] バンダイナムコエンターテインメント、スタートアップ投資ファンドを新設 |
https://www.itmedia.co.jp/business/articles/2204/12/news133.html
|
inamcoentertainmentfund |
2022-04-12 18:47:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] トヨタ、新型EV「bZ4X」発表 サブスク「KINTO」限定で5月発売へ |
https://www.itmedia.co.jp/business/articles/2204/12/news166.html
|
itmedia |
2022-04-12 18:44:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] ログイン戦争、鶏いじめ、投身RTA 平和な楽園「ハトバース」に異変か |
https://www.itmedia.co.jp/news/articles/2204/12/news174.html
|
itmedia |
2022-04-12 18:38:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] コロナ禍なのにラーメン店の倒産が4割減、過去10年で最少 なぜ? |
https://www.itmedia.co.jp/business/articles/2204/12/news169.html
|
itmedia |
2022-04-12 18:23:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia Mobile] au PAYが東京都/大阪府/京都府の3自治体と連携 5月1日から最大20%還元キャンペーン開催 |
https://www.itmedia.co.jp/mobile/articles/2204/12/news165.html
|
aupay |
2022-04-12 18:06:00 |
Google |
Official Google Blog |
Lessons from the International Journalism Festival |
https://blog.google/around-the-globe/google-europe/lessons-international-journalism-festival/
|
Lessons from the International Journalism FestivalThe International Journalism Festival in Perugia Italy is back after a two year hiatus due to the pandemic As we arrived in the beautiful city the energy was palpable as new connections were made and familiar faces from around the world and across the journalism community reunited We had the privilege of hearing from reporters news entrepreneurs and publishers of all sizes during the festival We listened and participated in panels that discussed everything from innovation and DEI in the newsroom to advocating for quality journalism and experimenting with new digital revenue streams We also announced some key developments for the Google News Initiative in Europe including The opening of the first Google News Initiative Innovation Challenge for Europe designed to stimulate innovation for small and medium sized organizations which provide credible information when it s needed most The opening of the Journalism AI Fellowship with Polis at the LSE The launch of the Google for Journalists playbook in languages I ve been going to this festival since and I learn something new every time Here are a couple of my personal takeaways this year Innovation is sprouting in more regions and in new and different waysWhether it s exploring new business models boosting reader engagement or working with technology to transform newsrooms news organizations across Europe are innovating One comment that resonated is that innovation is often placed in the important but not urgent pile when in fact if we are to successfully adapt to uncertainty and thrive then it s a priority Digital skills will enable a new wave of journalismLearning and career development can often take a back seat when you re a journalist writing to a deadline However from my own newsroom experience I know journalists are lifelong learners At Perugia we met freelance and newsroom journalists who are developing the necessary digital skills to combat misinformation engage specialist topics and experiment with different digital publishing platforms including podcasts newsletters virtual events and video We need to better support the mental health of journalistsThe psychological toll of covering the daily news agenda along with a sense of burnout is a pervasive issue amongst journalists In addition to the unique pressures of being a professional journalist the past two years have pushed many to the breaking point New initiatives to help restore the mental health of journalists are underway including a new expert program from HeadlinesNet and MINDCharity to create a suite of mental health resources to specifically address the needs of journalists In short if the role of a journalist is truly sustainable we require a renewed focus on mental health practices Diversity in the newsroomMany discussions centered around the impact diversity in the newsroom has in helping to better reflect the views of underrepresented audiences By focusing on solving problems for a specific community news organisations are differentiating themselves and creating value for their readers I m leaving Perugia inspired to experiment to share the learnings with my team and beyond and to try new approaches to big challenges Thank you to the organizers of this year s event to the countless volunteers who enabled the festival to take place and to all the journalists and journalism students we met this year Here s to Note from the Editor If you enjoyed this post watch this short videofeaturing Matt s highlights from the festival Off the record with Matt Cooke |
2022-04-12 09:32:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
ABC247 A~D問題 ものすごく丁寧でわかりやすい解説 python 灰色~茶色コーダー向け #AtCoder |
https://qiita.com/sano192/items/6a07fbbedb9fc556538e
|
atcoder |
2022-04-12 18:53:10 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
ifupdownパッケージを消したバカ |
https://qiita.com/amedama/items/b11fec62ae5b4fd6c682
|
ifupdown |
2022-04-12 18:51:43 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
本のISBNリストからレビューサイトのリンクをまとめて生成&開く |
https://qiita.com/gmailsms/items/b3ae27c4fe2aa8942119
|
goodreads |
2022-04-12 18:21:58 |
Program |
@IT Coding Edgeフォーラム 最新記事一覧 |
GitHub、Markdownファイルに「Mermaid」で図を挿入可能に |
https://atmarkit.itmedia.co.jp/ait/articles/2204/12/news043.html
|
github |
2022-04-12 18:30:00 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
M1MacでGemのmysql2でエラー |
https://qiita.com/isosa_yama/items/86ee62d8efa757cff71d
|
kercomposerubyprailsmysql |
2022-04-12 18:30:52 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
SVN から GitHub への移行手順 |
https://qiita.com/koichi-ozaki/items/477d08244006f7276f4c
|
github |
2022-04-12 18:20:40 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
git運用、developのオリジンをひっぱってくる |
https://qiita.com/vanshi/items/9830eec103eda1a90efa
|
origi |
2022-04-12 18:14:13 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
M1MacでGemのmysql2でエラー |
https://qiita.com/isosa_yama/items/86ee62d8efa757cff71d
|
kercomposerubyprailsmysql |
2022-04-12 18:30:52 |
技術ブログ |
Mercari Engineering Blog |
バッチ処理のリグレッションテスト自動化のトライ |
https://engineering.mercari.com/blog/entry/20220412-try-batch-regression-test-automation/
|
hellip |
2022-04-12 10:00:11 |
技術ブログ |
Developers.IO |
gdateが使い慣れないのでjqで日付処理をやってみた |
https://dev.classmethod.jp/articles/date-output-by-jq/
|
gdate |
2022-04-12 09:49:36 |
海外TECH |
MakeUseOf |
6 Simple Tips for Drying Your Smartphone USB Port |
https://www.makeuseof.com/tips-drying-smartphone-usb-port/
|
basic |
2022-04-12 09:10:13 |
海外TECH |
DEV Community |
Create a Torrent Application with Node from scratch. |
https://dev.to/swensson/create-a-torrent-application-with-node-from-scratch-1j3e
|
Create a Torrent Application with Node from scratch The best way to learn stuff in development is go and try to create your own whatever it is In this article I ll walk you through creating a minimal example of Torrent application using Node JS and swenssonpp library It is strongly advised to read and comment my previous article about making pp library from scratch in order to understand this one So Torrent is a PP network that lets peers exchange files The main idea behind it is that one file may appear at different peers and by chunking and splitting download streams peers can speed up files download PP network is used to exchange meta information about files while the actual download uses a separate TCP connection directly to the seed In this article I won t implement leeches but you may find this code in the repo later Okay so first of all I need to come up with some sort of interface for the end user to share the files using this application I ve decided to just index everything inside process cwd on application startup To store the files I decided to use Map where file s hash will be the key I also decided that I don t want this process to block user from doing what they want to do and I put indexing inside async function that is not being awaited for hashFile implementation is up to you const path require path const readdir stat require fs promises const index new Map async function findFiles folder for let filename of await readdir folder const filepath path resolve folder filename const filestats await stat filepath if filestats isDirectory yield findFiles filepath else yield path filepath size filestats size async gt console log Start indexing files for await let path size of findFiles process cwd const name path split slice const hash await hashFile path index set hash hash size name path console log Directory content indexed index size files found The next thing I want to do is to create a PP network I use swenssonpp and just call createNode It will set up a generic pp network node locally after that I run listen to start accepting connections I don t know exactly what I ll be doing after the startup I guess there should be many things so I leave an event emitter call socket that I can fill with the listeners later In order to be able to subscribe before listen callback is called I delay the listen call until all the synchronous code is completed const EventEmitter require events const createNode require swenssonpp const main new EventEmitter const node createNode const port Number process argv setTimeout gt node listen port gt main emit startup port After the node is up I proceed and let user know what they can do I want to use the same interface typing commands into process stdin that I ve used in chat application but I don t know exactly what commands I should have so I leave a socket actually two there as well main on startup port gt console log Node is up on port console log main emit help process stdin on data data gt main emit command data toString The first command as well as in chat application will be connect command main on help gt console log write connect IP PORT to connect to other nodes on the network main on command text gt if text startsWith connect const ipport text substr const ip port ipport split console log Connecting to ip at Number port node connect ip Number port gt console log Connection to ip established Now I want the user to be able to search for the files first I will only implement the search by name but you can add other parameters in this command as well Also the index does not help us looking for files at all but we will use it later I promise main on help gt console log write search FILENAME to look for files Once the command arrives we broadcast the search message on the networkmain on command text gt if text startsWith search const searchRequest text substr trim console log Searching for file by searchRequest node broadcast type search meta searchRequest Once we receive this message on another node we reply with resultsnode on broadcast origin message type meta gt if type search amp amp origin node id for let key of index keys const data index get key if data name toLowerCase includes meta toLowerCase node direct origin type search response meta data Once we receive the response from the file holder we display itnode on direct origin message type meta name size hash gt if type search response console log name formatSize size hash This ping pong style flow is easy to implement but feels unstable as we in theory can receive search response when no search has been issued and it still trigger the console log I don t consider this an issue but a safety check here won t hurt The next thing I want to do is that I want the user to be able to start download Since hash is used for the index we can use that as command s param which makes sense like you can create magnet links with file hashes and ask the application to download that without performing a search I don t know what I will do when download start right now so I leave a socket there main on help gt console log write download HASH to start downloading file main on command text gt if text startsWith download const hash text substr trim main emit download hash In order to download file we should establish a separate TCP connection to the peers and request chunks of data from them The amount of chunks and the file name are not the information we have locally even though we may have received it through search command it s not guaranteed So first of all I want to setup a ping pong flow to exchange file meta information before starting download It will be kinda the same as search flow but in the end I will store the exchanged information in downloads and emit events once they change As you can see the exchange information also contains the IP address of a seed so I can connect to it s file server while downloading later const downloads main on download hash gt node broadcast type download meta hash node on broadcast origin message type meta gt if type download amp amp origin node id const data index get meta if data node direct origin type download response meta ip Array from node addresses hash data hash size data size name data name node on direct origin message type meta gt if type download response if downloads meta hash downloads meta hash hash name meta name size meta size seeds meta ip chunks main emit download ready meta hash else downloads meta hash seeds push meta ip main emit download update meta hash Okay now it s time to create TCP server that will react on file data requests and send data We will exchange data in chunks so the file server will only need to react on one specific type of message and send one type of message back const FILES SERVER PORT const CHUNK SIZE const filesServer net createServer socket gt socket on data data gt const hash offset JSON parse data const meta index get hash const chunk Buffer alloc CHUNK SIZE const file await open meta path r await file read chunk CHUNK SIZE offset CHUNK SIZE await file close socket write JSON stringify hash offset chunk listen FILES SERVER PORT Alright now it s time to implement actual download I ll start by reacting to download ready event and making an async loop that will fetch chunks from seeds in parallel one chunk by one seed at a time but you can definitely tweak that In order to keep track of what chunk what state is I fill the chunks field of the meta information with it s status and socket it is using to download data from main on download ready async hash gt downloads hash chunks new Array Math ceil downloads hash size CHUNK SIZE map gt state In addition to that I need a temporary file to keep the download let s assign it and create a file handle for it downloads hash path path resolve DOWNLOADS PATH hash download const file await open downloads hash path w Now I need to connect to IP addresses provided in downloads I know that once download ready event is triggered there are already some but I also have to react to download update events to update the list I attach a listener to this event and detach it when download is finished const sockets const updateSocketsList async hash gt if hash hash return for let ip of downloads hash seeds if sockets ip const socket new net Socket socket connect FILES SERVER PORT ip gt sockets ip socket busy false updateSocketsList hash main on download update updateSocketsList TODO main off download update updateSocketsList The main cycle is pretty simple I look for an available chunk chunk state is ready is being downloaded and is already downloaded to download and a socket that is not busy If there is no socket meaning all of them are busy or no chunk meaning they all are being downloaded I just continue after ms delay If both available chunk and socket are presented I download but do not await for this download to finish while downloads hash chunks find chunk gt chunk state const availableChunkIndex downloads hash chunks findIndex chunk gt chunk state const availableSocket Object values sockets find busy gt busy if availableSocket availableChunkIndex await new Promise resolve gt setTimeout gt resolve continue availableSocket busy true downloads hash chunks availableChunkIndex state async gt const chunk await downloadChunk availableSocket socket hash availableChunkIndex await file write Buffer from chunk CHUNK SIZE availableChunkIndex CHUNK SIZE downloads hash chunks availableChunkIndex state availableSocket busy false As you can see I only have to implement the downloadChunk function that will actually grab data from socket I want it to be an async function while socket is an event emitter so I need to do the following const downloadChunk socket hash offset gt new Promise resolve gt socket write JSON stringify hash offset const listener message gt if hash message hash amp amp offset message offset resolve message chunk socket off data listener socket on data listener Now I only need to cleanup by closing the file handle renaming the temp file to whatever the filename it should have removing listeners to download update and closing seed sockets await file close await rename downloads hash path path resolve DOWNLOADS PATH downloads hash name main off download update updateSocketsList for let socket of Object values sockets socket destroy This is how you can make a simplest Torrent application in less that lines of code with Node and swenssonpp Full code of this app can be found here |
2022-04-12 09:41:30 |
海外TECH |
DEV Community |
10 Minutes revision note to Pass Terraform Exam |
https://dev.to/aws-builders/10-minutes-revision-note-to-pass-terraform-exam-3de6
|
Minutes revision note to Pass Terraform Exam DAY Minutes revision note to Pass Terraform Exam Day Twenty Seven days of Cloud on GitHub Read On iCTPro co nz Read on Dev to A Github Repo LinkThis repository might help you to do a revision to pass the Terraform Associate Exam Links to resources to study for Terraform Associate Exam Links to Learning platforms for terraform A brief explanation about all terraform exam related topics Some useful links Connect with me on Twitter Connect with me on LinkedinRead more post on dev to or iCTPro co nzConnect with me on GitHub |
2022-04-12 09:34:34 |
海外TECH |
DEV Community |
Wtf is Walkthrough Documentation?🤔 |
https://dev.to/itai/wtf-is-walkthrough-documentation-200j
|
Wtf is Walkthrough Documentation I like to call Walkthrough Documentation the missing link between low level amp high level documentation And it s something that is often over looked But in my opinion Walkthrough Documentation is where the value in documenting lies So what is Walkthrough Documentation This form of documentation takes readers on a guided tour of the code base It uses code snippets to explain points of interest on the map As it moves from landmark to landmark it can point out recurring patterns It can describe interactions between different blocks of code that may reside quite far from each other or even multiple repositories Recurring patterns in codeRepos contains patterns For example deriving from a base class calling a specific API to read from a database creating a new config value adding a new CLI command and the list goes on When a new dev joins your team they will most probably perform one of the above mentioned tasks amp will need to understand how they re done in your codebase This could be easy if the patterns are simple But more often than not patterns aren t so simple and span many different often far away files in your codebase and can be tricky to understand on your own And thus the need for Walkthrough Documentation comes into play Here s an exampleAdding a new CLI command specifically with git CLI Let s say that you want to contribute to the git project by adding the command git mycmd and you want to understand how such a pattern is achieved in git s source code Take a look at the git clone a pre existing example of said pattern This command along with every other command comes with a corresponding file in the builtin directory in our case builtin clone c and contains the function that implements the command Declaring the function isn t enough we also need to declare it in builtin h Next up register the command so that git knows where to find it The way to do this is to add it to the commands list of structs detailing the commands in git c And last but not least add the command s file to our Makefile This explanation is tightly code coupled and goes over specific implementation details including how to name functions where to put files the builtin dir function signatures how to name files clone c builtin h variable names BUILTIN OBJS etc The explanation walks the user through different areas of the code that are all related to the single pattern of adding a command to the CLI This kind of highly focused tour through the code can really help the user grasp the pattern and understand it quickly But there are challenges Yes it takes time Yes value is lost if it s not properly maintained My colleague delves into the challenges amp how you can overcome them in this article So what are your thoughts on walkthrough documentation |
2022-04-12 09:31:13 |
海外TECH |
DEV Community |
You finished your Bootcamp. Now what? |
https://dev.to/404answernotfound/you-finished-your-bootcamp-now-what-4963
|
You finished your Bootcamp Now what Original article first posted at answernotfound eu blog The developer s job market and BootcampsAnywhere you go in any nation in the world we live in one might encounter this problem the job market Yes the job market can be problematic and only a few professions are safe to a point What do I mean by that Well speaking in Layman s terms there are jobs that require a vast amount of knowledge even just to get access to them Now don t fret I m not talking about the family first safe jobs for family kind of thing I m referring rather to those that most of the times ensure that entry is allowed only to the more knowledgeable individuals Don t get me wrong I do strongly believe and stand firm by the idea that some professions ought to be opened only to those that studied hard and proved that they can do it I m thinking medical school aerospace engineering and so much more But with the continuous development and evolution of our jobs and the ways we work some jobs are opening up where they didn t not long before I m talking about programming web development and so much more You go back a few years and not even that many and you can definitely see how only a nerd was capable and able to do the programmer s job correctly Heck developers weren t even that much of a rockstar back then so what happened People did Programmers are surely not a new thing Internet as well has its own age already but what stands out is the fact that from and on more and more people joined the Internet revolution building our world as we know it now and the more people there will be on the Internet the more programmers will be needed to build what satisfies the human nature through algorithmic and digital solutions From this a thing was noticed there was opportunity there was lack of labour and need for solutions So a story was told and spread throughout the globe we need more programmers we need more people that are able to write code because that s where humans are going If you ask me this story is kind of pushed a little bit too much but I can agree with the fact that technology will be part of our life more and more with every passing day And to use technology one should better know technology because as any good instruments it is yet another one that needs mastering So this lead us to where we are today a world with a prosperous economy and right now also a few wars and so many self labeled programmers that showcase their bootcamp experience on every profile they own be it LinkedIn Twitter or any other Now if you are one of those self labeled programmers you might feel a little bit offended but trust the reading a bit further and you shall be surprised I m a self taught developer which means that I didn t exactly go to a school that would prepare me to become a good programmer but I do find that I am a decent one indeed Hopefully this is also shown by the fact that at the moment of this writing I m entrusted with the position of Head of Development at my current company One might argue self taught doesn t mean that you studied three months and hoped to become a rockstar developer Indeed you would correct I study everyday for hours to update on my current technology stack and to know more technologies and even newer ones It doesn t take three months to become a good programmer but it can take three months to start being a programmer This is everything you need from this blog post but I will be writing a little bit more Programming is an art and as any artists that fall in love with the subject you the programmer will try and try again to better yourself The first drawing of your code will probably be not much of a piece of art but that will not stop you from pursuing your dream career and that s the exact moment you will know that you were always a programmer a code artist a logical tinkerer Those are the keys to the kingdom and you will need nothing else Be wary of those that will tell you otherwise but also be very aware that three months of code school will not always open golden doors It takes effort and it takes time and it will take a toll on you every time you feel like failing and succeeding and failing and succeeding and it will happen a lot so don t ever think that you are not enough It just takes time As per the topic the job market will be open to you if you will be a good candidate for the jobs that are offered And for our older programmers like myself we should not fear new people joining us because they will bring fresh views more professionalism and lateral thinking which is pure gold and you know it A warning to the younger devs younger as in profession age not human age not a lot of people get to work for Google Facebook Amazon Netflix and all those amazing places If you don t get there it doesn t mean anything Always remember to do your best study hard and bring results That s what matters the rest is fun because programming is fun creating things is fun and everything is art The goodbyeHere are two interesting articles that you may find useful on your developer s journey ➢An imposter syndrome analysis for programmers by a programmer➢How to learn programming as easy as possibleI hope you found this article useful and to your liking and if you have any requests drop a message on one of my social media accounts or open an issue start a discussion on github on this repository As always you can find me on Twitter listen to my Podcast on Spotify and add me on LinkedIn to talk professionally yeah right |
2022-04-12 09:06:52 |
海外TECH |
DEV Community |
Hack: Access Private Class Members in TypeScript |
https://dev.to/zirkelc/hack-access-private-class-members-in-typescript-41jp
|
Hack Access Private Class Members in TypeScriptI know we shouldn t access private class members But sometimes there is simply no way around For instance during unit tests we can access private members to assert the correct values Or while debugging we want to log a private property to the console In TypeScript there are two ways to do this The first option is to cast the object to any The problem with this option is that you loose type safety and intellisense autocompletion The second option is the intentional escape hatch This is a bug or feature in Typescript which was left open for this very purpose It allows access to private members via bracket notation while maintaining type safety and autocompletion class Test public foo string Foo private bar string Bar public constructor const test new Test cast as anyconsole log test as any bar intentional escape hatchconsole log test bar Check it yourself at TypeScript Playground |
2022-04-12 09:05:23 |
海外TECH |
DEV Community |
iOS dev— import music from user’s device using document picker |
https://dev.to/canopassoftware/ios-dev-import-music-from-users-device-using-document-picker-53aj
|
iOS devーimport music from user s device using document pickerHow to import music from device using document picker Here s the guide to how can we import local music from your iPhone or iPad s file app into your iOS application Many times as a developer we come across requirements where we want to add some music from your local music library instead of getting it from API Here s a step by step guide to learn how to import music from user device using document picker |
2022-04-12 09:05:22 |
海外TECH |
DEV Community |
Vacancy |
https://dev.to/azaliya_ka/vacancy-4k2
|
VacancySkills amp RequirementsProfessional engineering experience with RustKnowledge and experience of SolanaComprehensive understanding of the crypto blockchainExperience with EVM related developmentExperience with Smart ContractsExperience with backend technology is a plusKeeping a vigilant eye on security considerations and developing with a security centric mindset USD Contact with me askarovakamilla gmail com |
2022-04-12 09:03:15 |
海外TECH |
DEV Community |
Scrape Google Finance Ticker Quote Data in Python |
https://dev.to/dmitryzub/scrape-google-finance-ticker-quote-data-in-python-3pk2
|
Scrape Google Finance Ticker Quote Data in PythonWhat will be scrapedPrerequisitesScraping Google Finance Ticker Quote DataExplanation on Extracting Ticker DataScrape Multiple Google Finance Tickers QuotesExtract Google Finance Chart Time Series DataScraping Google Finance Time Series DataExplanation on Time Series Extraction CodeNASDAQ Rate LimitsAdditional Nasdaq API ResourcesLinksOutroWhat will be scrapedPrerequisitesBasic knowledge scraping with CSS selectorsCSS selectors declare which part of the markup a style applies to thus allowing to extract data from matching tags and attributes If you haven t scraped with CSS selectors there s a dedicated blog post of mineabout how to use CSS selectors when web scraping that covers what it is pros and cons and why they matter from a web scraping perspective Separate virtual environmentIn short it s a thing that creates an independent set of installed libraries including different Python versions that can coexist with each other in the same system thus preventing libraries or Python version conflicts If you didn t work with a virtual environment before have a look at thededicated Python virtual environments tutorial using Virtualenv and Poetry blog post of mine to get a little bit more familiar Note this is not a strict requirement for this blog post Install libraries pip install requests parselReduce the chance of being blockedThere s a chance that a request might be blocked Have a lookat how to reduce the chance of being blocked while web scraping there are eleven methods to bypass blocks from most websites Scraping Google Finance Ticker Quote Datadef scrape google finance ticker str params hl en language headers User Agent Mozilla Windows NT Win x AppleWebKit KHTML like Gecko Chrome Safari html requests get f ticker params params headers headers timeout selector Selector text html text where all extracted data will be temporary located ticker data ticker data about panel news items finance perfomance table people also search for items interested in items current price quote title extraction ticker data ticker data current price selector css AHmHk fxKbKc text get ticker data ticker data quote selector css PdOqHc text get replace • ticker data ticker data title selector css zzDege text get about panel extraction about panel keys selector css gyFHrc mfsFc text getall about panel values selector css gyFHrc PKc xpath normalize space getall for key value in zip longest about panel keys about panel values key value key lower replace ticker data about panel key value value description about extraction ticker data about panel description selector css bLLbd text get ticker data about panel extensions selector css wtnNd text getall news extarction if selector css yYLee get for index news in enumerate selector css yYLee start ticker data news items append position index title news css Yfwt text get link news css zrsb a attr href get source news css sfyJob text get published news css Adak text get thumbnail news css img Zidke attr src get else ticker data news error f No news result from a ticker finance perfomance table if selector css slpEwd roXhBd get fin perf col selector css PFjsMe yNnsfe text get e g Dec fin perf col selector css PFjsMe yNnsfe yNnsfe text get e g Year year change for fin perf in selector css slpEwd roXhBd if fin perf css JJhg text jUVAc text get perf key fin perf css JJhg text jUVAc text get e g Revenue Net Income Operating Income perf value col fin perf css QXDnM text get B perf value col fin perf css gEUVJe JwBzf text get ticker data finance perfomance table append perf key fin perf col perf value col fin perf col perf value col else ticker data finance perfomance error f No finence perfomance table for ticker you may be interested in results if selector css HDXgAf tOzDHb get for index other interests in enumerate selector css HDXgAf tOzDHb start ticker data interested in items append discover more tickers index other interests else ticker data interested in error f No you may be interested in results for ticker people also search for results if selector css HDXgAf div tOzDHb get for index other tickers in enumerate selector css HDXgAf div tOzDHb start ticker data people also search for items append discover more tickers index other tickers else ticker data people also search for error f No people also search for in results for ticker return ticker datadef discover more tickers index int other data str if price change formatted will start complaining check beforehand for None values with try except and set it to in this function however re search r d d d should make the job done return position index ticker other data css COaKTb text get ticker link f other data attrib href replace title other data css RwFyvf text get price other data css YMlKec text get price change other data css jsname FeoBc attr aria label get Up by gt price change formatted re search r d d d other data css jsname FeoBc attr aria label get group scrape google finance ticker GOOGL NASDAQ Explanation on Extracting Ticker DataImport libraries import requests json refrom parsel import Selectorfrom itertools import zip longest itertools zip longestLibraryPurposerequeststo make a request to the website jsonto convert extracted data to a JSON object reto extract parts of the data via regular expression parselto parse data from HTML XML documents Similar to BeautifulSoup zip longestto iterate over several iterables in parallel More on that below Define a function def scrape google finance ticker str ticker should be a string further code scrape google finance ticker GOOGL NASDAQ Create request headers and URL parameters passing parameters in urlsparams hl en language custom headers headers User Agent Mozilla Windows NT Win x AppleWebKit KHTML like Gecko Chrome Safari LibraryPurposeparams a prettier way of passing URL parameters to a request user agentto act as a real user request from the browser by passing it to request headers Check what s your user agent Pass requests parameters and request headers make a request and pass response to parsel html requests get f ticker params params headers headers timeout selector Selector text html text CodeExplanationf ticker is a f string where ticker will be replaced by actual ticker string e g GOOGL NASDAQ timeout to stop waiting for response after secods Selector text html text where passed HTML from the response will be processed by parsel Create an empty dictionary structure where all the data will be filled in where all extracted data will be temporarily locatedticker data ticker data about panel news items finance perfomance table people also search for items interested in items Extarcting current price quote and title data current price quote title extractionticker data ticker data current price selector css AHmHk fxKbKc text get ticker data ticker data quote selector css PdOqHc text get replace • ticker data ticker data title selector css zzDege text get CodeExplanationticker data ticker data current price accesses ticker data key and creates a new key current price and assigns it to whatever value would be extracted by parsel Same for new quote and title keys textis a parsel own pseudo element support which will translate every CSS query to XPath In this case text would become text get to get actual data replace • to replace someting old with something new Extracting right panel data about panel keys selector css gyFHrc mfsFc text getall about panel values selector css gyFHrc PKc xpath normalize space getall for key value in zip longest about panel keys about panel values key value key lower replace ticker data about panel key value valueCodeExplanationgetall to get all a list of matches xpath normalize space to get blank text nodes as well By default blank text nodes will be skippet resulting not a complete output lower to lowercase all string characters zip longest to combine multiple iterators Difference between zip and zip longest is that zip ends at the shortest iterator while zip longest iterates up to the length of the longest iterator key value will dynamically add a key to a dictionary with it s own extracted value Extracting description and extensions data from the right panel description about and extensions extractionticker data about panel description selector css bLLbd text get ticker data about panel extensions selector css wtnNd text getall Extracting news results news extarctionif selector css yYLee get for index news in enumerate selector css yYLee start ticker data news items append position index title news css Yfwt text get link news css zrsb a attr href get source news css sfyJob text get published news css Adak text get thumbnail news css img Zidke attr src get else ticker data news error f No news result from a ticker CodeExplanationif selector css yYLee get to check if news results is present No need to check if lt element gt is not None enumerate to add a counter to an iterable and return it start will start counting from instead from the default value of ticker data news append to append extracted data to a list as dictionary attr src is also a parsel pseudo element support to get src attribute from the node Equivalent to XPath src ticker data news error to create a new error key and a message when the error occurs Extracting Financial Perfomance table data finance perfomance table checks if finance table existsif selector css slpEwd roXhBd get fin perf col selector css PFjsMe yNnsfe text get e g Dec fin perf col selector css PFjsMe yNnsfe yNnsfe text get e g Year year change for fin perf in selector css slpEwd roXhBd if fin perf css JJhg text jUVAc text get if fin perf css get statement is needed otherwise first dict key and sub dict values would be None finance perfomance table null Dec null Year year change null perf key fin perf css JJhg text jUVAc text get e g Revenue Net Income Operating Income perf value col fin perf css QXDnM text get B perf value col fin perf css gEUVJe JwBzf text get ticker data finance perfomance table append perf key fin perf col perf value col dynamically add key and value from the second column fin perf col perf value col dynamically add key and value from the third column else ticker data finance perfomance error f No finence perfomance table for ticker Extracting you may be interested in people also search for results you may be interested in results if selector css HDXgAf tOzDHb get for index other interests in enumerate selector css HDXgAf tOzDHb start ticker data interested in items append discover more tickers index other interests else ticker data interested in error f No you may be interested in results for ticker people also search for results if selector css HDXgAf div tOzDHb get for index other tickers in enumerate selector css HDXgAf div tOzDHb start ticker data people also search for items append discover more tickers index other tickers else ticker data people also search for error f No people also search for in results for ticker def discover more tickers index int other data str if price change formatted will start complaining check beforehand for None values with try except or if statement and set it to however re search r d d d should get the job done return position index ticker other data css COaKTb text get ticker link f other data attrib href replace title other data css RwFyvf text get price other data css YMlKec text get price change other data css jsname FeoBc attr aria label get Up by gt price change formatted re search r d d d other data css jsname FeoBc attr aria label get group CodeExplanationdiscover more tickers created function used to combine two identical code into single function This way code needs to be changed in one place only attrib attribute name to get a node attribute jsname FeoBc is a CSS selector that used to select elements with the specified attribute and value e g attribute value re search to match parts of the string and grab only digits and values And group to return matched string by a regular expression Return and print the data def scrape google finance ticker str ticker data ticker data about panel news items finance perfomance table people also search for items interested in items extraction code return ticker dataprint json dumps data indent ensure ascii False Full output ticker data current price quote GOOGL NASDAQ title Alphabet Inc Class A about panel previous close day range year range market cap T USD volume M p e ratio dividend yield primary exchange NASDAQ ceo Sundar Pichai founded Oct headquarters Mountain View CaliforniaUnited States website abc xyz employees description Alphabet Inc is an American multinational technology conglomerate holding company headquartered in Mountain View California It was created through a restructuring of Google on October and became the parent company of Google and several former Google subsidiaries The two co founders of Google remained as controlling shareholders board members and employees at Alphabet Alphabet is the world s third largest technology company by revenue and one of the world s most valuable companies It is one of the Big Five American information technology companies alongside Amazon Apple Meta and Microsoft nThe establishment of Alphabet Inc was prompted by a desire to make the core Google business cleaner and more accountable while allowing greater autonomy to group companies that operate in businesses other than Internet services Founders Larry Page and Sergey Brin announced their resignation from their executive posts in December with the CEO role to be filled by Sundar Pichai also the CEO of Google Page and Brin remain co founders employees board members and controlling shareholders of Alphabet Inc extensions Stock US listed security US headquartered news position title Amazon Splitting Stock Alphabet Too Which Joins the Dow First link source Barron s published month ago thumbnail ANdGcRlfwbKPlMPsOheYDvvANIfevHplzZ YdaQO pRCIDXPOXGtZBQk position title Alphabet s quantum tech group Sandbox spins off into an independent company link source CNBC published weeks ago thumbnail ANdGcSIyvWZJgDvwtMWeRAsImXtTZSmorfmCKIASkB XofZfZAbDLAMolhk position title Cash Rich Berkshire Hathaway Apple and Alphabet Should Gain From Higher nRates link source Barron s published weeks ago thumbnail ANdGcSZdJhvXlKrWlTmHiHxlfYVbViPDAra xVLhNUOaNSRuPmt sjhc position title Amazon s Stock Split Follows Alphabet s Here s Who s Next link source Barron s published month ago thumbnail ANdGcSJGKkikLT YToKJlJnhWaaj ujLvhhZObw suZcu YyaDDO Llsmaqt position title Amazon Alphabet and Other Beaten Up Growth Stocks Set to Soar link source Barron s published weeks ago thumbnail ANdGcTxotkdpUxhmCTJIOtMf yVKvZbafvtpXCyosyBWAuXQt tDs position title Is It Too Late to Buy Alphabet Stock link source The Motley Fool published weeks ago thumbnail ANdGcQvDGFKMNUPvMdaRvipyOaumh FBPjLCNKcHvEZ gFUkI finance perfomance Revenue Dec B Year year change Net income Dec B Year year change Diluted EPS Dec Year year change Net profit margin Dec Year year change Operating income Dec B Year year change Net change in cash Dec B Year year change Cash and equivalents Dec B Year year change Cost of revenue Dec B Year year change people also search for position ticker GOOG ticker link NASDAQ title Alphabet Inc Class C price price change Down by price change formatted other results position ticker SQ ticker link NYSE title Block Inc price price change Down by price change formatted interested in position ticker Index ticker link INDEXSP title S amp P price price change Down by price change formatted other results position ticker NFLX ticker link NASDAQ title Netflix Inc price price change Down by price change formatted Scrape Multiple Google Finance Tickers Quotesfor ticker in DAX INDEXDB GOOGL NASDAQ MSFT NASDAQ data scrape google finance ticker ticker print json dumps data ticker data indent ensure ascii False Outputs current price quote DAX Index title DAX PERFORMANCE INDEX current price quote GOOGL NASDAQ title Alphabet Inc Class A current price quote MSFT NASDAQ title Microsoft Corporation Extract Google Finance Chart Time Series DataScraping time series data is not a particularly good idea so it s better to use a dedicated API to get the job done How to find which API Google uses to build time series charts We can confirm that Google is using NASDAQ API to get time series data by simply checking Nasdaq chart with the quote GOOGL In this case I used Nasdaq Data Link API which has a support for Python R and Excel I believe other platforms provide Python integration as well I m assuming that you have already installed a nasdaq data link package but if not here s how you can do it If you set up a default version of Python WSL pip install nasdaq data linkIf you don t set up a default version of Python WSL python m pip install nasdaq data link change python to your version python XGet your API key at data nasdaq com account profile Create a env file to store your API key there touch nasdaq api key change the file name to yours paste API key inside the created fileScraping Google Finance Time Series Dataimport nasdaqdatalinkdef nasdaq get timeseries data nasdaqdatalink read key filename nasdaq api key print nasdaqdatalink ApiConfig api key prints api key from the nasdaq api key file timeseries data nasdaqdatalink get WIKI GOOGL collapse monthly not sure what WIKI stands for print timeseries data nasdaq get timeseries data Time Series Extraction Code ExplanationCodeExplanationnasdaqdatalink read key filename nasdaq api key to read your API key nasdaq api key is your env variable with secret API key All secret variables correct me if I m wrong starts with a symbol to showcase it nasdaqdatalink ApiConfig api keyto test out if your API is being recognized by the nasdaq data link package Example output adA avdCXauv zxsnasdaqdatalink get to get the time series data which is dataset structure Outputs a pandas DataFrame object Open High Low Close Volume Ex Dividend Split Ratio Adj Open Adj High Adj Low Adj Close Adj VolumeDate rows x columns As you can see there are no data about the years It s because I m using the Free version which is suitable for experimentation and exploration as Nasdaq saying Nasdaq rate limitsAuthenticated usersPremium users calls per seconds calls per minutes calls per minutes limit calls per day limit calls per day Additional Nasdaq API ResourcesResourceExplanationTimes series parametersto customize manipulate your time series dataset by adding additional parameters to a request Transformation of time series dataComposing a request with curlto easily make a request using curl Available saving formatsto save data in CSV XML JSONData formatsto convert the data into available formats Downloading in bulkto download all the data in a database in a single call Detailed guide on available methodsto understand how to use data link python package in more details data link python on GitHubto read full documentation quandl python on GitHubWhat data link python is using under the hood You can find a little bit more documentation here LinksCode in the online IDEGitHub repositoryOutroIf you have anything to share any questions suggestions or something that isn t working correctly reach out via Twitter at dimitryzub or serp api Yours Dmitriy and the rest of SerpApi Team Join us on Twitter YouTubeAdd a Feature Requestor a Bug |
2022-04-12 09:02:13 |
Apple |
AppleInsider - Frontpage News |
New Mac mini reference spotted in Studio Display firmware |
https://appleinsider.com/articles/22/04/12/new-mac-mini-reference-spotted-in-studio-display-firmware?utm_medium=rss
|
New Mac mini reference spotted in Studio Display firmwareA reference to an as yet unannounced new Mac mini has been found backing up rumors of a revised model being launched soon The new Mac mini could use a new two tone design and plexiglass like top coverThe Mac mini was one of the first machines to get Apple Silicon and it has more recently been rumored to be among the first to get a second generation M version Read more |
2022-04-12 09:24:34 |
海外TECH |
Engadget |
Anker chargers and accessories are up to 44 percent off today at Amazon |
https://www.engadget.com/anker-chargers-accessories-44-percent-off-amazon-091425912.html?src=rss
|
Anker chargers and accessories are up to percent off today at AmazonYou can grab a few Anker accessories at a discount today as part of Amazon s one day sale The discounted items include an assortment of powerbanks chargers and cables with prices marked down for up to percent off If you re looking for something to help tame all the wires in your home or office one of the items you can get from the sale is Anker s power strip surge protector that s currently available for That s percent off its usual price of and is the lowest price we ve seen for the power strip on the website It has three outlets on one side as well as three USB ports and one W PowerIQ USB C port on the other The USB C port supports fast charging and can power even a quot MacBook and other similar devices nbsp Buy Anker chargers and accessories at AmazonThe Anker Nano Pro USB C charger is also on sale for which is lower than its retail price It was designed specifically for the iPhone and can provide full speed watt charging for the iPhone The charger has the capability to adjust power output ensuring the safety of the device that s plugged in and comes with a three feet USB C to Lightning cable But if you re just looking for a UBS C to USB C cable for your devices Anker also has feet watt cables on sale in packages of two The cables support fast charging for up to watts when used with a compatible charger and work with any USB C device including MacBook Pros iPads and Samsung Galaxy phones You can get the two pack cables for or less than their usual price of nbsp Follow EngadgetDeals on Twitter for the latest tech deals and buying advice |
2022-04-12 09:14:25 |
海外TECH |
CodeProject Latest Articles |
Use Remote-Storage, a Community-Derived FOSS, Offline-First, Un-Hosted, Zero-Back-End for Your Web Product :: a How-To Tutorial Guide. |
https://www.codeproject.com/Articles/5329553/Use-Remote-Storage-a-Community-Derived-FOSS-Offlin
|
remotestorage |
2022-04-12 09:27:00 |
ニュース |
@日本経済新聞 電子版 |
歌舞伎動画・中国のゲーム審査・パキスタン首相失職
https://t.co/rXoSUcfxj8 |
https://twitter.com/nikkei/statuses/1513810334511144968
|
首相 |
2022-04-12 09:24:43 |
ニュース |
@日本経済新聞 電子版 |
スピードスケートの小平奈緒が10月のレースを最後に現役引退の意向表明。日本のエースとして長く活躍し、2018年平昌五輪での金メダルはスピード女子の日本勢で初の快挙となりました。
https://t.co/5odCS20rv4 |
https://twitter.com/nikkei/statuses/1513807905849589762
|
スピードスケートの小平奈緒が月のレースを最後に現役引退の意向表明。 |
2022-04-12 09:15:04 |
ニュース |
@日本経済新聞 電子版 |
EV世界販売460万台、HV超え ホンダは5兆円投資
【日経イブニングスクープ】
https://t.co/EFE3KUBkcr |
https://twitter.com/nikkei/statuses/1513804545553743873
|
世界販売 |
2022-04-12 09:01:43 |
海外ニュース |
Japan Times latest articles |
Far from defeated, Putin intends to escalate war in Ukraine |
https://www.japantimes.co.jp/news/2022/04/12/world/putin-plans-to-escalate-war/
|
Far from defeated Putin intends to escalate war in UkraineAfter a meeting with Putin Austria s chancellor said he came away fearing that the Russian president intended to drastically intensify the brutality of the war |
2022-04-12 18:11:35 |
海外ニュース |
Japan Times latest articles |
Japan sprinter Nao Kodaira to close book on storied career |
https://www.japantimes.co.jp/sports/2022/04/12/more-sports/winter-sports-more-sports/speedskating-kodaira-retirement/
|
Japan sprinter Nao Kodaira to close book on storied careerThe year old speedskater competed at four consecutive Winter Olympics from the Vancouver Games and has long been one of the dominant forces in women s |
2022-04-12 18:00:53 |
ニュース |
BBC News - Home |
Crispin Blunt apologises for defending sex offender MP Imran Ahmad Khan |
https://www.bbc.co.uk/news/uk-politics-61077747?at_medium=RSS&at_campaign=KARANGA
|
assault |
2022-04-12 09:46:59 |
ニュース |
BBC News - Home |
Public sector staff hit as price rises outpace pay |
https://www.bbc.co.uk/news/business-61077200?at_medium=RSS&at_campaign=KARANGA
|
private |
2022-04-12 09:26:16 |
ニュース |
BBC News - Home |
Turner Prize 2022: Trafalgar Square whipped cream artist among nominees |
https://www.bbc.co.uk/news/entertainment-arts-61078208?at_medium=RSS&at_campaign=KARANGA
|
fourth |
2022-04-12 09:19:23 |
ニュース |
BBC News - Home |
Rape prosecution plan lacks ambition, say MPs |
https://www.bbc.co.uk/news/uk-61073880?at_medium=RSS&at_campaign=KARANGA
|
mpsmps |
2022-04-12 09:22:19 |
ビジネス |
不景気.com |
ビザスクの22年2月期は4億円の最終赤字へ、買収費用で - 不景気.com |
https://www.fukeiki.com/2022/04/visasq-2022-loss.html
|
最終赤字 |
2022-04-12 09:20:43 |
北海道 |
北海道新聞 |
教員採用試験の出願、13日から受け付け |
https://www.hokkaido-np.co.jp/article/668631/
|
教員採用 |
2022-04-12 18:21:00 |
北海道 |
北海道新聞 |
道内工房が監修、大丸にチーズ菓子店 |
https://www.hokkaido-np.co.jp/article/668630/
|
woodstock |
2022-04-12 18:20:00 |
北海道 |
北海道新聞 |
北見市、ゼロカーボン宣言 再生エネ導入や温室効果ガス削減推進 本年度から目標や計画策定へ |
https://www.hokkaido-np.co.jp/article/668628/
|
二酸化炭素 |
2022-04-12 18:17:00 |
北海道 |
北海道新聞 |
闘病支える手編みの帽子 町立中標津病院看護師3人、がん患者支援 無償で提供「力になりたい」 |
https://www.hokkaido-np.co.jp/article/668626/
|
抗がん剤治療 |
2022-04-12 18:13:00 |
北海道 |
北海道新聞 |
友人女性ら盗撮疑い、京大生逮捕 「金になるかも」動画公開 |
https://www.hokkaido-np.co.jp/article/668616/
|
京都府警 |
2022-04-12 18:11:51 |
北海道 |
北海道新聞 |
13日の予告先発 日本ハムは立野 |
https://www.hokkaido-np.co.jp/article/668623/
|
予告先発 |
2022-04-12 18:09:01 |
北海道 |
北海道新聞 |
佐々木朗希、視聴数が歴代最高に DAZN、10日の完全試合 |
https://www.hokkaido-np.co.jp/article/668539/
|
完全試合 |
2022-04-12 18:07:19 |
北海道 |
北海道新聞 |
大手百貨店2社、黒字転換 そごう・西武は赤字幅縮小 |
https://www.hokkaido-np.co.jp/article/668624/
|
黒字転換 |
2022-04-12 18:06:00 |
北海道 |
北海道新聞 |
バドミントン、山口や桃田ら代表入り ユーバー杯とトマス杯 |
https://www.hokkaido-np.co.jp/article/668605/
|
代表入り |
2022-04-12 18:05:36 |
北海道 |
北海道新聞 |
JR東、異常に備え送電線新設へ 昨年10月の変電所火災受け |
https://www.hokkaido-np.co.jp/article/668622/
|
首都圏 |
2022-04-12 18:05:00 |
北海道 |
北海道新聞 |
観光特急「あをによし」29日デビュー 近鉄、需要回復を見据え |
https://www.hokkaido-np.co.jp/article/668555/
|
日本鉄道 |
2022-04-12 18:03:24 |
北海道 |
北海道新聞 |
西本願寺、5年がかりの修復工事完了 総事業費12億円 |
https://www.hokkaido-np.co.jp/article/668615/
|
京都市下京区 |
2022-04-12 18:01:03 |
マーケティング |
AdverTimes |
テーブルマーク、研究開発部を廃止 食品総合研究所を新設 |
https://www.advertimes.com/20220412/article381620/
|
研究開発 |
2022-04-12 09:29:13 |
コメント
コメントを投稿