How to access to the text that is in a section that exists more than once in a html file? - html

enter image description here
How do I do to access to the value of the budget, just '6000000'.
tent1 = filmclean.find('h3',{'class':'subheading'}).get_text()
I know that this only returns 'Box Office', but if I do:
tent1 = filmclean.find('div',{'class':'txt-block'}).get_text()
it returns "Taglines: An offer you can't refuse." which, I belive, is the text for the first time that the class 'subheading' it appears.

Looking at the markup on picture, you can do:
print( filmclean.select_one('h3.subheading + div h4').find_next(text=True).strip() )
But without URL is hard to be 100% sure.

Related

Docs Inserted Image always before all text

Making a simple app script that puts images and Text into a Google Doc separated by 2 Columns, for whatever reason, no matter the way I try it the images are always above the text (Inline) in the Doc, even though they should be layered (Inline),
//Replace QR Code
let qrText = editLocalBody.findText("{{qrCode}}");
let setImagePlace = qrText.getElement().asText().replaceText("{{qrCode}}", "");
let qrCodeImage = setImagePlace.getParent().asParagraph().insertInlineImage(0, qrCodeBlob);
From what I've seen this should insert an image wherever the text was previously located, but when it runs this it's always in the wrong spot, somehow above the text it was suppost to be in!
//Edit - To Show The Progression Of What Is Suppose To Happen And What Actually Happens:
I'm making QR Code badges for a propriety system that runs integrated tightly with Google, so I'm using appscript to get an entry from a google form containing an amount of badges (With relevent data) and autofill a Google Doc Accordingly.
// Loop Start
I fill my template with a text line that has key words in it I can select and replace later, with a keyword it can use to insert another this (This Part Works)
I first edit (findText("{{qrCode}}");) the QR Code, replacing (.replaceText) the keyword for it to nothing ("")
I then get the parent of the piece of code I ran above, which is a block of text (I think all the text in the Doc, I think this is where the issue lies, it puts it above the text because it's just one 'paragraph' or not multiple 'bodies' of text, if I could separate this I think it would work!) As a paragraph, and insert An Inline Image at Child Index (0, of the image ,qrCodeBlob)
I've debugged this script quite a bit, so I know It's that final line that inserting images fails, it sees all the text as 'one'.
// I want this (In Descending Order, each it's own full line):
Image
Text
Image
Text
//What It Gives Me (In Descending Order, each it's own full line):
Image
Image
Text
Text
let qrCodeImage = setImagePlace.getParent().asParagraph().insertInlineImage(0, qrCodeBlob);

Is it posible to have If sentence within iterator on calypso HTML tag

In the sample code that you will see always go through the else sentence, even with hard code within the IF sentence to go through "PAY" case.
If the IF sentence is not with a iterator works perfectly, but in this case I need to validate one value that's on the iterator "|SETTLEMENT_TO_PAYREC|"
enter image description here
At the end what i want to show is if the SETTLEMENT_TO_PAYREC = PAY show this column SETTLEMENT_PO_SDI_ABA
else if SETTLEMENT_TO_PAYREC = RECEIVE show this column
SETTLEMENT_CNTP_SDI_ABA
is it possible to do this or my code is wrong?

powerapp adding changing hyperlinks

I am extremely new to Powerapps in fact this is my first project with it. What I want to do is link to a web-page that contains a Knowledge base the body of the hyperlink stays as it is the only thing that changes is the ID it needs to look for.
I have created an app and each article contains its own KB# and i need that KB# to be inserted into the hyperlink. The Text I marked in bold below is the only change in the link. I have created a button that should run the Hyperlink once click and in the OnSelect area I add the below but that is just a static link.
If(Rule2, Launch("https://placeholder.com/nav_to.do?uri=%2Fkb_view.do%3Fsysparm_article%3D||KB0010007||%26sysparm_stack%3D%26sysparm_view%3D")
, Launch("https://placeholder.com/nav_to.do?uri=%2Fkb_view.do%3Fsysparm_article%3DKB0011526%26sysparm_stack%3D%26sysparm_view%3D")
)
You should use string concatenation operator &
In your case:
If(Rule2,
Launch("https://placeholder.com/nav_to.do?uri=%2Fkb_view.do%3Fsysparm_article%3D||KB" & DataSource.column_name & "||%26sysparm_stack%3D%26sysparm_view%3D") ,
Launch("https://placeholder.com/nav_to.do?uri=%2Fkb_view.do%3Fsysparm_article%3DKB0011526%26sysparm_stack%3D%26sysparm_view%3D") )

Access VBA Create Word header with text and position picture

Having trouble getting access vba to set a word document's header properly. I've got this.
oDoc.PageSetup.DifferentFirstPageHeaderFooter = True
oDoc.Sections(1).Headers(wdHeaderFooterFirstPage).Range.InlineShapes.AddPicture "C:\Users\mr.helpless\Pictures\doody.jpg"
oDoc.Sections(1).Headers(wdHeaderFooterFirstPage).Range.Text = "hello there"
oDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = "whooo hooo!"
What happens right now is the text will replace the picture for the first page (subsequent pages are fine).
I need to have the picture and text - and I need to offset the picture to the left about half an inch while text is centered with normal margins.
Any idea how to go about it? Basically I need to set a document letterhead with a logo.
Update
Dim myText As String
myText = "hello there"
With oDoc.Sections(1).Headers(wdHeaderFooterFirstPage)
.Shapes.AddPicture Filename:="C:\Users\mr.helpless\Pictures\doody.jpg", LinkToFile:=False, SaveWithDocument:=True
.Range.Collapse
.Range.InsertAfter (myText)
.Range.Font.Name = "Helvetica"
.Range.Font.Size = 8
.Range.Font.Bold = True
.Range.Paragraphs.Alignment = wdAlignParagraphCenter
End With
I've got half of it done, now I just need to position the image to -.5 to margin.
Completed Solution
Just add "Left:=-35" to the picture like such (or whatever value works)
.Shapes.AddPicture Filename:="C:\Users\mr.helpless\Pictures\doody.jpg", LinkToFile:=False, SaveWithDocument:=True, Left:=-35
Have you tried recording a macro in Word that does the rough reposition - then bring the code over to Access and edit it for the correct object and size?
All of it is updated in the original thread. it took using the .Range Collapse to add in text along with the image and it took putting Left:=(value) to move it where I needed it.

Selenium, Python 3, simple scraping text from Erowid LSD experiences?

Based off of an answer on here about a similar thing, I tried to scrape the text of Erowid trip experiences. The URL has a bunch of trip links. I want to click each link and then print the 'report-text-surround' element, which is the trip text.
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://www.erowid.org/experiences/exp.cgi?S1=2&S2=-3&C1=9&Str=')
#I tried to get hrefs by xpath, knowing that each trip links starts with 'exp.php?ID'.
view_links = driver.find_elements_by_xpath("""//*[contains(text(), 'exp.php?ID')]""")
for index, view in enumerate(view_links):
html = view.get_attribute('innerHTML')
href = html.split('"')[1]
view_links[index] = href
#And then visit each href and get the data
for href in view_links:
driver.get(href)
#I know this is the element containing the trip text.
trip_text = driver.find_elements_by_class_name('report-text-surround')
for trip in trip_text:
print (trip.text.encode('utf-8'))
So you are pretty close but there are just 2 small mistakes.
trip_text = driver.find_elements_by_class_name('report-text-surround')
for trip in trip_text:
print (trip.text.encode('utf-8'))
Your driver.find_elements_by_class_name should not be plural, as there is only one on the page. It has a lot of elements, but only one class ('report-text-surround'). This means you're going to get all the text at once, you could change this but you'd have to go through the child elements or get the elements seperately.
You can change that entire section to this:
text = (driver.find_element_by_class_name('report-text-surround').text).encode('utf-8')
print(text);
That will give you all of the text in the entire article. An easy way to split this up after would be to split each part of the text by \n\n.